diff --git a/langtools/test/com/sun/javadoc/5093723/T5093723.java b/langtools/test/com/sun/javadoc/5093723/T5093723.java index 8bea133cc07..6ffa7d16945 100644 --- a/langtools/test/com/sun/javadoc/5093723/T5093723.java +++ b/langtools/test/com/sun/javadoc/5093723/T5093723.java @@ -25,23 +25,24 @@ * @test * @bug 5093723 * @summary REGRESSION: ClassCastException in SingleIndexWriter - * @library ../lib/ + * @library ../lib * @build JavadocTester - * @build T5093723 * @run main T5093723 */ public class T5093723 extends JavadocTester { - private static final String[] ARGS = new String[] { - "-d", OUTPUT_DIR + ".out", "-Xdoclint:none", - SRC_DIR + "/DocumentedClass.java", - SRC_DIR + "/UndocumentedClass.java" - }; - - public static void main(String... args) { + public static void main(String... args) throws Exception { T5093723 tester = new T5093723(); - if (tester.runJavadoc(ARGS) != 0) - throw new AssertionError("non-zero return code from javadoc"); + tester.runTests(); + } + + @Test + void test() { + javadoc("-d", "out", + "-Xdoclint:none", + testSrc("DocumentedClass.java"), + testSrc("UndocumentedClass.java")); + checkExit(Exit.OK); } } diff --git a/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java b/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java index 699be36583a..359ea876531 100644 --- a/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java +++ b/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java @@ -26,142 +26,31 @@ * @bug 4706779 4956908 * @summary Add text equivalent of class tree ASCII art for accessibility * @author dkramer + * @library ../lib + * @build JavadocTester * @run main AccessAsciiArt */ +public class AccessAsciiArt extends JavadocTester { -import com.sun.javadoc.*; -import java.util.*; -import java.io.*; - - -/** - * Runs javadoc and runs regression tests on the resulting HTML. - * It reads each file, complete with newlines, into a string to easily - * find strings that contain newlines. - */ -public class AccessAsciiArt { - - private static final String BUGID = "4706779-4956908"; - private static final String BUGNAME = "AccessAsciiArt"; - private static final String TMPDEST_DIR1 = "./docs1/"; - private static final String TMPDEST_DIR2 = "./docs2/"; - - // Subtest number. Needed because runResultsOnHTML is run twice, - // and subtestNum should increment across subtest runs. - public static int subtestNum = 0; - public static int numSubtestsPassed = 0; - - // Entry point - public static void main(String[] args) { - - // Directory that contains source files that javadoc runs on - String srcdir = System.getProperty("test.src", "."); - - // Test for all cases except the split index page - runJavadoc(new String[] {"-d", TMPDEST_DIR1, - "-sourcepath", srcdir, - "p1", "p1.subpkg"}); - runTestsOnHTML(testArray); - - printSummary(); + public static void main(String... args) throws Exception { + AccessAsciiArt tester = new AccessAsciiArt(); + tester.runTests(); } - /** Run javadoc */ - public static void runJavadoc(String[] javadocArgs) { - if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) { - throw new Error("Javadoc failed to execute"); - } - } + @Test + void test() { + javadoc("-d", "out", + "-sourcepath", testSrc, + "p1", "p1.subpkg"); + checkExit(Exit.OK); - /** - * Assign value for [ stringToFind, filename ] - * NOTE: The standard doclet uses the same separator "\n" for all OS's - */ - private static final String[][] testArray = { - - // Test the top line of the class tree - { -"
DEFAULT_NAME" +
- "
public static final java." + - "lang.String DEFAULT_NAME"}, - { "pkg/AnnotationType.html", - "
\n\n" + - "
" + - "" + "
DEFAULT_NAME"
+ + "
public static final java." + + "lang.String DEFAULT_NAME"); + + checkOutput("pkg/AnnotationType.html", true, + "
\n\n" + + "
" + + "" + "
Link to math package
"},
- { "C.html",
- "Link to AttributeContext innerclass
"},
- { "C.html",
- "Link to external class BigDecimal
"},
- { "C.html",
- "Link to external member gcd
"},
- { "C.html",
- "toString
in class java.lang.Object
Link to math package
",
+ "Link to AttributeContext innerclass
",
+ "Link to external class BigDecimal
",
+ "Link to external member gcd
",
+ "toString
in class java.lang.Object
i
- a param.i
- a param.Inner()
, \n" +
- "Inner(int)
, \n" +
- "NestedInner()
, \n" +
- "NestedInner(int)
, \n" +
- "Outer()
, \n" +
- "Outer(int)
"
- },
- { "pkg1/Outer.html",
- "Link: Inner()
, " +
- "Outer(int)
, " +
- "" +
- "NestedInner(int)
"
- },
- { "pkg1/Outer.html",
- "Outer()"
- },
- { "pkg1/Outer.html",
- ""
- },
- { "pkg1/Outer.html",
- "Outer(int i)"
- },
- { "pkg1/Outer.html",
- ""
- },
- { "pkg1/Outer.Inner.html",
- "Inner()"
- },
- { "pkg1/Outer.Inner.html",
- ""
- },
- { "pkg1/Outer.Inner.html",
- "Inner(int i)"
- },
- { "pkg1/Outer.Inner.html",
- ""
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "NestedInner()"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- ""
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "NestedInner(int i)"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- ""
- }
- };
-
- private static final String[][] NEGATED_TEST = {
- { "pkg1/Outer.Inner.html",
- "Outer.Inner--"
- },
- { "pkg1/Outer.Inner.html",
- "Outer.Inner-int-"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "Outer.Inner.NestedInner--"
- },
- { "pkg1/Outer.Inner.NestedInner.html",
- "Outer.Inner.NestedInner-int-"
- },
- { "pkg1/Outer.html",
- "Outer.Inner()
"
- },
- { "pkg1/Outer.html",
- "Outer.Inner(int)
"
- },
- { "pkg1/Outer.html",
- "Outer.Inner.NestedInner()
"
- },
- { "pkg1/Outer.html",
- "Outer.Inner.NestedInner(int)
"
- }
- };
-
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) throws Exception {
+ public static void main(String... args) throws Exception {
TestConstructors tester = new TestConstructors();
- tester.run(ARGS, TEST, NEGATED_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg1");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/Outer.html", true,
+ "Inner()
, \n"
+ + "Inner(int)
, \n"
+ + "NestedInner()
, \n"
+ + "NestedInner(int)
, \n"
+ + "Outer()
, \n"
+ + "Outer(int)
",
+ "Link: Inner()
, "
+ + "Outer(int)
, "
+ + ""
+ + "NestedInner(int)
",
+ "Outer()",
+ "",
+ "Outer(int i)",
+ "");
+
+ checkOutput("pkg1/Outer.Inner.html", true,
+ "Inner()",
+ "",
+ "Inner(int i)",
+ "");
+
+ checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
+ "NestedInner()",
+ "",
+ "NestedInner(int i)",
+ "");
+
+ checkOutput("pkg1/Outer.Inner.html", false,
+ "Outer.Inner--",
+ "Outer.Inner-int-");
+
+ checkOutput("pkg1/Outer.Inner.NestedInner.html", false,
+ "Outer.Inner.NestedInner--",
+ "Outer.Inner.NestedInner-int-");
+
+ checkOutput("pkg1/Outer.html", false,
+ "Outer.Inner()
",
+ "Outer.Inner(int)
",
+ "Outer.Inner.NestedInner()
",
+ "Outer.Inner.NestedInner(int)
");
}
}
diff --git a/langtools/test/com/sun/javadoc/testCustomTag/TestCustomTag.java b/langtools/test/com/sun/javadoc/testCustomTag/TestCustomTag.java
index b7fc0f2231c..0e69c20259b 100644
--- a/langtools/test/com/sun/javadoc/testCustomTag/TestCustomTag.java
+++ b/langtools/test/com/sun/javadoc/testCustomTag/TestCustomTag.java
@@ -26,69 +26,67 @@
* @bug 8006248
* @summary Test custom tag. Verify that an unknown tag generates appropriate warnings.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester taglets.CustomTag TestCustomTag
+ * @library ../lib
+ * @build JavadocTester taglets.CustomTag
* @run main TestCustomTag
*/
public class TestCustomTag extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR, "-tagletpath", SRC_DIR,
- "-taglet", "taglets.CustomTag", "-sourcepath",
- SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
-
- private static final String[] ARGS1 = new String[] {
- "-d", OUTPUT_DIR + "-1", "-tagletpath",
- SRC_DIR, "-taglet", "taglets.CustomTag",
- "-sourcepath", SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
- private static final String[] ARGS2 = new String[] {
- "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-sourcepath",
- SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
-
- private static final String[] ARGS3 = new String[] {
- "-d", OUTPUT_DIR + "-3", "-sourcepath",
- SRC_DIR, SRC_DIR + "/TagTestClass.java"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = new String[][] {
- {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
- }
- };
-
- private static final String[][] TEST1 = new String[][] {
- {ERROR_OUTPUT, "error: unknown tag: unknownTag"
- }
- };
- private static final String[][] TEST2 = new String[][] {
- {WARNING_OUTPUT, "warning - @customTag is an unknown tag."
- },
- {WARNING_OUTPUT, "warning - @unknownTag is an unknown tag."
- }
- };
-
- private static final String[][] TEST3 = new String[][] {
- {ERROR_OUTPUT, "error: unknown tag: customTag"
- },
- {ERROR_OUTPUT, "error: unknown tag: unknownTag"
- }
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestCustomTag tester = new TestCustomTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.run(ARGS1, TEST1, NO_TEST);
- tester.run(ARGS2, TEST2, NO_TEST);
- tester.run(ARGS3, TEST3, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test1() {
+ javadoc("-Xdoclint:none",
+ "-d", "out-1",
+ "-tagletpath", testSrc, // TODO: probably useless
+ "-taglet", "taglets.CustomTag",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.OK);
+
+ checkOutput(Output.WARNING, true,
+ "warning - @unknownTag is an unknown tag.");
+ }
+
+ @Test
+ void test2() {
+ javadoc("-d", "out-2",
+ "-tagletpath", testSrc, // TODO: probably useless
+ "-taglet", "taglets.CustomTag",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.FAILED);
+
+ checkOutput(Output.ERROR, true,
+ "error: unknown tag: unknownTag");
+ }
+
+ @Test
+ void test3() {
+ javadoc("-Xdoclint:none",
+ "-d", "out-3",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.OK);
+
+ checkOutput(Output.WARNING, true,
+ "warning - @customTag is an unknown tag.",
+ "warning - @unknownTag is an unknown tag.");
+ }
+
+ @Test
+ void test4() {
+ javadoc("-d", "out-4",
+ "-sourcepath", testSrc,
+ testSrc("TagTestClass.java"));
+ checkExit(Exit.FAILED);
+
+ checkOutput(Output.ERROR, true,
+ "error: unknown tag: customTag",
+ "error: unknown tag: unknownTag");
}
}
diff --git a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
index c31f7d215d8..fb1a1ab49f1 100644
--- a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
+++ b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
@@ -26,76 +26,65 @@
* @bug 4927552 8026567
* @summary @Deprecated\n" +
- "public class DeprecatedClassByAnnotation\n" +
- "extends java.lang.Object
"},
-
- {TARGET_FILE2, "@Deprecated\n" + - "public int field\n" + - "
@Deprecated\n" + - "public DeprecatedClassByAnnotation()\n" + - "
@Deprecated\n" + - "public void method()\n" + - "
@Deprecated\n"
+ + "public class DeprecatedClassByAnnotation\n"
+ + "extends java.lang.Object
",
+ "@Deprecated\n" + + "public int field\n" + + "
@Deprecated\n" + + "public DeprecatedClassByAnnotation()\n" + + "
@Deprecated\n" + + "public void method()\n" + + "
File
"},
- { "TestDocRootTag.html",
- "glossary"},
- { "TestDocRootTag.html",
- "Second File Link
"},
- { "TestDocRootTag.html", "The value of @docRoot is \"./\""},
- { "index-all.html", "My package page is " +
- "here"}
- };
- private static final String[] ARGS =
- new String[] {
- "-bottom", "The value of @docRoot is \"{@docRoot}\"",
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-linkoffline", "http://www.java.sun.com/j2se/1.4/docs/api",
- SRC_DIR, SRC_DIR + "/TestDocRootTag.java", "pkg"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestDocRootInlineTag tester = new TestDocRootInlineTag();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ String uri = "http://www.java.sun.com/j2se/1.4/docs/api";
+
+ javadoc("-bottom", "The value of @docRoot is \"{@docRoot}\"",
+ "-d", "out",
+ "-sourcepath", testSrc,
+ "-linkoffline", uri, testSrc,
+ testSrc("TestDocRootTag.java"), "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("TestDocRootTag.html", true,
+ "File
",
+ "glossary",
+ "Second File Link
",
+ "The value of @docRoot is \"./\"");
+
+ checkOutput("index-all.html", true,
+ "My package page is here");
}
}
diff --git a/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java b/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java
index 972254630ff..377cdce7dbf 100644
--- a/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java
+++ b/langtools/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java
@@ -26,109 +26,78 @@
* @bug 6553182 8025416 8029504
* @summary This test verifies the -Xdocrootparent option.
* @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestDocRootLink
+ * @library ../lib
+ * @build JavadocTester
* @run main TestDocRootLink
*/
public class TestDocRootLink extends JavadocTester {
- private static final String[][] TEST1 = {
- { "pkg1/C1.html",
- "Refer Here"
- },
- { "pkg1/C1.html",
- "This Here should not be replaced\n" +
- " with an absolute link."
- },
- { "pkg1/C1.html",
- "Testing Link 1 and\n" +
- " Link 2."
- },
- { "pkg1/package-summary.html",
- "\n" +
- " Test document 1"
- },
- { "pkg1/package-summary.html",
- "\n" +
- " Another Test document 1"
- },
- { "pkg1/package-summary.html",
- "\n" +
- " Another Test document 2."
- }
- };
- private static final String[][] NEGATED_TEST1 = {
- { "pkg1/C1.html",
- ""
- },
- { "pkg1/C1.html",
- ""
- },
- { "pkg1/package-summary.html",
- ""
- },
- { "pkg1/package-summary.html",
- ""
- }
- };
- private static final String[][] TEST2 = {
- { "pkg2/C2.html",
- "Refer Here"
- },
- { "pkg2/C2.html",
- "This Here should not be replaced\n" +
- " with an absolute link."
- },
- { "pkg2/C2.html",
- "Testing Link 1 and\n" +
- " Link 2."
- },
- { "pkg2/package-summary.html",
- "\n" +
- " Test document 1"
- },
- { "pkg2/package-summary.html",
- "\n" +
- " Another Test document 1"
- },
- { "pkg2/package-summary.html",
- "\n" +
- " Another Test document 2."
- }
- };
- private static final String[][] NEGATED_TEST2 = {
- { "pkg2/C2.html",
- ""
- },
- { "pkg2/C2.html",
- ""
- },
- { "pkg2/package-summary.html",
- ""
- },
- { "pkg2/package-summary.html",
- ""
- }
- };
- private static final String[] ARGS1 =
- new String[]{
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1", "pkg2"
- };
- private static final String[] ARGS2 =
- new String[]{
- "-d", OUTPUT_DIR + "-1", "-Xdocrootparent",
- "http://download.oracle.com/javase/7/docs", "-sourcepath",
- SRC_DIR, "pkg1", "pkg2"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestDocRootLink tester = new TestDocRootLink();
- tester.run(ARGS1, TEST1, NEGATED_TEST1);
- tester.run(ARGS2, TEST2, NEGATED_TEST2);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test1() {
+ javadoc("-d", "out-1",
+ "-sourcepath", testSrc,
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg1/C1.html", true,
+ "Refer Here",
+ "This Here should not be replaced\n" +
+ " with an absolute link.",
+ "Testing Link 1 and\n" +
+ " Link 2.");
+
+ checkOutput("pkg1/package-summary.html", true,
+ "\n" +
+ " Test document 1",
+ "\n" +
+ " Another Test document 1",
+ "\n" +
+ " Another Test document 2.");
+
+ // TODO: should this check *any* reference to http://download.oracle.com/
+ checkOutput("pkg1/C1.html", false,
+ "",
+ "");
+
+ checkOutput("pkg1/package-summary.html", false,
+ "",
+ "");
+ }
+
+ @Test
+ void test2() {
+ javadoc("-d", "out-2",
+ "-Xdocrootparent", "http://download.oracle.com/javase/7/docs",
+ "-sourcepath", testSrc,
+ "pkg1", "pkg2");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg2/C2.html", true,
+ "Refer Here",
+ "This Here should not be replaced\n" +
+ " with an absolute link.",
+ "Testing Link 1 and\n" +
+ " Link 2.");
+
+ checkOutput("pkg2/package-summary.html", true,
+ "\n" +
+ " Test document 1",
+ "\n" +
+ " Another Test document 1",
+ "\n" +
+ " Another Test document 2.");
+
+ checkOutput("pkg2/C2.html", false,
+ "",
+ "");
+
+ checkOutput("pkg2/package-summary.html", false,
+ "",
+ "");
}
}
diff --git a/langtools/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java b/langtools/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java
index 94981f92c45..2d7e355e7bf 100644
--- a/langtools/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java
+++ b/langtools/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java
@@ -27,28 +27,26 @@
* @summary Test to ensure that the doclet does not print out bad
* warning messages about duplicate param tags.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestDupParamWarn
* @run main TestDupParamWarn
*/
public class TestDupParamWarn extends JavadocTester {
- private static final String[] ARGS =
- new String[] {"-d", OUTPUT_DIR, "-sourcepath",
- SRC_DIR + "/", "pkg"};
- private static final String[][] NEGATED_TEST =
- new String[][] {{WARNING_OUTPUT,
- "Parameter \"a\" is documented more than once."}};
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
JavadocTester tester = new TestDupParamWarn();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput(Output.WARNING, false,
+ "Parameter \"a\" is documented more than once.");
}
}
diff --git a/langtools/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java b/langtools/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java
index 96b019202aa..48593211815 100644
--- a/langtools/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java
+++ b/langtools/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java
@@ -27,39 +27,32 @@
* @summary Test to make sure that Javadoc behaves properly when
* run on a completely empty class (no comments or members).
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestEmptyClass
* @run main TestEmptyClass
*/
public class TestEmptyClass extends JavadocTester {
- private static final String[][] NEGATED_TEST = {
+ public static void main(String... args) throws Exception {
+ TestEmptyClass tester = new TestEmptyClass();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-classpath", testSrc("src"),
+ "-d", "out",
+ "-sourcepath", testSrc("src"),
+ testSrc("src/Empty.java"));
+ checkExit(Exit.OK);
//The overview tree should not link to classes that were not documented
- { "overview-tree.html", ""},
+ checkOutput("overview-tree.html", false,
+ "");
//The index page should not link to classes that were not documented
- { "index-all.html", ""},
- };
- private static final String[] ARGS =
- new String[] {
- "-classpath", SRC_DIR + "/src",
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR + "/src",
- SRC_DIR + "/src/Empty.java"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
- TestEmptyClass tester = new TestEmptyClass();
- int exitCode = tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
- if (exitCode != 0) {
- throw new Error("Error found while executing Javadoc");
- }
+ checkOutput("index-all.html", false,
+ "");
}
}
diff --git a/langtools/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java b/langtools/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java
index 86affecf6c6..9e7d9681796 100644
--- a/langtools/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java
+++ b/langtools/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java
@@ -26,31 +26,26 @@
* @bug 5008230
* @summary Check the outer class when documenting enclosing class/interface.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestEnclosingClass
* @run main TestEnclosingClass
*/
public class TestEnclosingClass extends JavadocTester {
- //Javadoc arguments.
- private static final String[] ARGS = new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
- };
-
- //Input for string search tests.
- private static final String[][] TEST = {
- { "pkg/MyClass.MyInterface.html", "Enclosing class:"}
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestEnclosingClass tester = new TestEnclosingClass();
- tester.run(ARGS, TEST, NO_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "pkg");
+ checkExit(Exit.OK);
+
+ checkOutput("pkg/MyClass.MyInterface.html", true,
+ "Enclosing class:");
}
}
diff --git a/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java b/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java
index 5627f4718a4..83ab93b0e08 100644
--- a/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java
+++ b/langtools/test/com/sun/javadoc/testEncoding/TestEncoding.java
@@ -27,32 +27,28 @@
* @summary This test determines if the value of the -encoding option is
* properly passed from Javadoc to the source file parser.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester
- * @build TestEncoding
* @run main TestEncoding
*/
public class TestEncoding extends JavadocTester {
-
- //If ??? is found in the output, the source file was not read with the correct encoding setting.
- private static final String[][] NEGATED_TEST = {
- { "EncodeTest.html", "??"}
- };
- private static final String[] ARGS =
- new String[] {
- "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
- "-encoding", "iso-8859-1", SRC_DIR + "/EncodeTest.java"
- };
-
- /**
- * The entry point of the test.
- * @param args the array of command line arguments.
- */
- public static void main(String[] args) {
+ public static void main(String... args) throws Exception {
TestEncoding tester = new TestEncoding();
- tester.run(ARGS, NO_TEST, NEGATED_TEST);
- tester.printSummary();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out",
+ "-sourcepath", testSrc,
+ "-encoding", "iso-8859-1",
+ testSrc("EncodeTest.java"));
+ checkExit(Exit.OK);
+
+ // If ??? is found in the output, the source file was not read with the correct encoding setting.
+ checkOutput("EncodeTest.html", false,
+ "??");
}
}
diff --git a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
index 71e318c509a..0f2864891ad 100644
--- a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
+++ b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java
@@ -28,41 +28,38 @@
* are documented properly. The method should still include "implements" or
* "overrides" documentation even though the method is external.
* @author jamieh
- * @library ../lib/
+ * @library ../lib
* @build JavadocTester TestExternalOverridenMethod
* @run main TestExternalOverridenMethod
*/
public class TestExternalOverridenMethod extends JavadocTester {
- private static final String[][] TEST = {
- { "pkg/XReader.html",
- "read
in class " +
- "FilterReader
readInt
in interface " +
- "DataInput
read
in class "
+ + "FilterReader
readInt
in interface "
+ + "DataInput
public class C1\n" +
"extends java.lang.Object\n" +
- "implements java.io.Serializable
"},
- { "pkg1/C4.html",
+ "implements java.io.Serializable");
+ checkOutput("pkg1/C4.html", true,
"" +
- "C2
, \n" +
- "" +
- "Serialized FormsetUndecorated(boolean)
title
- the titletest
- boolean value" +
- "java.lang.IllegalArgumentException
- if the " +
- "owner
's\n" +
- " GraphicsConfiguration
is not from a screen " +
- "deviceHeadlessException
undecorated" +
- "
- true
if no decorations are\n" +
- " to be enabled;\n" +
- " false
" +
- "if decorations are to be enabled.readObject()" +
- "
java.io.IOException
setUndecorated(boolean)
set
- boolean" +
- "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n" +
- "C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n" +
- "" +
- "IOException
java.io.IOException
"
+ + "C2
, \n"
+ + ""
+ + "Serialized FormsetUndecorated(boolean)
title
- the titletest
- boolean value"
+ + "java.lang.IllegalArgumentException
- if the "
+ + "owner
's\n"
+ + " GraphicsConfiguration
is not from a screen "
+ + "deviceHeadlessException
undecorated"
+ + "
- true
if no decorations are\n"
+ + " to be enabled;\n"
+ + " false
"
+ + "if decorations are to be enabled.readObject()"
+ + "
java.io.IOException
setUndecorated(boolean)
set
- boolean"
+ + "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n"
+ + "C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n"
+ + ""
+ + "IOException
java.io.IOException
C2
title
- the title" +
- "test
- boolean valuejava.lang.IllegalArgumentException" +
- "
- if the owner
's\n" +
- " GraphicsConfiguration" +
- "
is not from a screen device" +
- "HeadlessException
undecorated
- true
" +
- " if no decorations are\n" +
- " to be enabled;\n" +
- " false
if decorations are to be enabled." +
- "readObject()
java.io.IOException
setUndecorated(boolean)
" +
- "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n" +
- "C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n" +
- "" +
- "IOException
java.io.IOException
title
- the title"
+ + "test
- boolean valuejava.lang.IllegalArgumentException"
+ + "
- if the owner
's\n"
+ + " GraphicsConfiguration"
+ + "
is not from a screen device"
+ + "HeadlessException
undecorated
- true
"
+ + " if no decorations are\n"
+ + " to be enabled;\n"
+ + " false
if decorations are to be enabled."
+ + "readObject()
java.io.IOException
setUndecorated(boolean)
"
+ + "java.io.IOException
C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n"
+ + "C1.setUndecorated(boolean)
setUndecorated(boolean)
.\n"
+ + ""
+ + "IOException
java.io.IOException
public void readObject()\n" + " throws java.io.IOException\n" + - ""}, - { "pkg1/C2.html", "
public C2()\n" + - ""}, - { "pkg1/C1.ModalExclusionType.html", "
public " + + ""); + + checkOutput("pkg1/C2.html", expectFound, + "public C2()\n" + + ""); + + checkOutput("pkg1/C1.ModalExclusionType.html", expectFound, + "public " + "static final C1.ModalExclusionType " + "APPLICATION_EXCLUDE\n" + - ""}, - { "serialized-form.html", "boolean " + + ""); + + checkOutput("serialized-form.html", expectFound, + "boolean " + "undecorated\n" + "" + "Deprecated. As of JDK version 1.5, replaced by\n" + "\n" + - ""}, - { "serialized-form.html", "" + + "", + "" + "Deprecated. As of JDK version" + " 1.5, replaced by\n" + " " + "" + "setUndecorated(boolean)
.setUndecorated(boolean)
.\n" + - ""}}; - - // Test for valid HTML generation which should not comprise of empty - // definition list tags. - private static final String[][] NEGATED_TEST_NO_C5 = { - { "pkg1/package-summary.html", - ""}, - { "pkg1/package-summary.html", - "
\n" + - "
"}, - { "pkg1/C1.html", - ""}, - { "pkg1/C1.html", - "
\n" + - "
"}, - { "pkg1/C1.ModalExclusionType.html", - ""}, - { "pkg1/C1.ModalExclusionType.html", - "
\n" + - "
"}, - { "pkg1/C2.html", - ""}, - { "pkg1/C2.html", - "
\n" + - "
"}, - { "pkg1/C2.ModalType.html", - ""}, - { "pkg1/C2.ModalType.html", - "
\n" + - "
"}, - { "pkg1/C3.html", - ""}, - { "pkg1/C3.html", - "
\n" + - "
"}, - { "pkg1/C4.html", - ""}, - { "pkg1/C4.html", - "
\n" + - "
"}, - { "overview-tree.html", - ""}, - { "overview-tree.html", - "
\n" + - "
"}, - { "serialized-form.html", - ""}, - { "serialized-form.html", - "
\n" + - "
"}}; - private static final String[][] NEGATED_TEST_C5 = { - { "pkg1/C5.html", - ""}, - { "pkg1/C5.html", - "
\n" + - "
"}}; - - private static final String[] ARGS1 = - new String[] { - "-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"}; - - private static final String[] ARGS2 = - new String[] { - "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath", - SRC_DIR, "pkg1"}; - - private static final String[] ARGS3 = - new String[] { - "-Xdoclint:none", "-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath", - SRC_DIR, "pkg1"}; - - private static final String[] ARGS4 = - new String[] { - "-Xdoclint:none", "-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated", - "-sourcepath", SRC_DIR, "pkg1"}; - - /** - * The entry point of the test. - * @param args the array of command line arguments. - */ - public static void main(String[] args) { - TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag(); - tester.run(ARGS1, TEST_ALL, NEGATED_TEST_NO_C5); - tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5); - tester.runTestsOnHTML(TEST_CMNT_DEPR, NO_TEST); - - tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5); - tester.runTestsOnHTML(NO_TEST, NEGATED_TEST_C5); - tester.runTestsOnHTML(NO_TEST, TEST_CMNT_DEPR); - - tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5); - tester.runTestsOnHTML(TEST_NODEPR, TEST_NOCMNT_NODEPR); - - tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5); - tester.runTestsOnHTML(TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR); - - tester.printSummary(); + ""); } } diff --git a/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java b/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java index b2b2d5679c4..5d44dd3787a 100644 --- a/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java +++ b/langtools/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java @@ -27,33 +27,38 @@ * @test * @bug 6851834 * @summary This test verifies the HTML document generation for javadoc output. + * @library ../lib + * @build JavadocTester * @author Bhavesh Patel - * @build TestHtmlDocument * @run main TestHtmlDocument */ -import java.io.*; import com.sun.tools.doclets.formats.html.markup.*; /** * The class reads each file, complete with newlines, into a string to easily * compare the existing markup with the generated markup. */ -public class TestHtmlDocument { - - protected static final String NL = System.getProperty("line.separator"); - - private static final String BUGID = "6851834"; - private static final String BUGNAME = "TestHtmlDocument"; - private static String srcdir = System.getProperty("test.src", "."); +public class TestHtmlDocument extends JavadocTester { // Entry point - public static void main(String[] args) throws IOException { + public static void main(String... args) throws Exception { + TestHtmlDocument tester = new TestHtmlDocument(); + tester.runTests(); + } + + @Test + void test() { + checking("markup"); // Check whether the generated markup is same as the existing markup. - if (generateHtmlTree().equals(readFileToString(srcdir + "/testMarkup.html"))) { - System.out.println("\nTest passed for bug " + BUGID + " (" + BUGNAME + ")\n"); + String expected = readFile(testSrc, "testMarkup.html"); + String actual = generateHtmlTree(); + if (actual.equals(expected)) { + passed(""); } else { - throw new Error("\nTest failed for bug " + BUGID + " (" + BUGNAME + ")\n"); + failed("expected content in " + testSrc("testMarkup.html") + "\n" + + "Actual output:\n" + + actual); } } @@ -136,25 +141,4 @@ public class TestHtmlDocument { HtmlDocument htmlDoc = new HtmlDocument(htmlDocType, html); return htmlDoc.toString(); } - - // Read the file into a String - public static String readFileToString(String filename) throws IOException { - File file = new File(filename); - if ( !file.exists() ) { - System.out.println("\nFILE DOES NOT EXIST: " + filename); - } - BufferedReader in = new BufferedReader(new FileReader(file)); - StringBuilder fileString = new StringBuilder(); - // Create an array of characters the size of the file - try { - String line; - while ((line = in.readLine()) != null) { - fileString.append(line); - fileString.append(NL); - } - } finally { - in.close(); - } - return fileString.toString(); - } } diff --git a/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java b/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java index a29bf387fc3..cba3d5961bc 100644 --- a/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java +++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java @@ -26,44 +26,49 @@ /* * @test * @bug 6786028 8026567 - * @summary This test verifys the use of HTML tag instead of by Javadoc std doclet. + * @summary This test verifies the use of HTML tag instead of by Javadoc std doclet. * @author Bhavesh Patel - * @library ../lib/ + * @library ../lib * @build JavadocTester - * @build TestHtmlStrongTag * @run main TestHtmlStrongTag */ public class TestHtmlStrongTag extends JavadocTester { - private static final String[][] TEST1 = { - { "pkg1/C1.html", - "See Also:"}}; - private static final String[][] NEGATED_TEST1 = { - { "pkg1/C1.html", "Method Summary"}, - { "pkg1/C1.html", ""}, - { "pkg1/package-summary.html", - "Class Summary"}}; - private static final String[][] TEST2 = { - { "pkg2/C2.html", "Comments:"}}; - private static final String[][] NEGATED_TEST2 = { - { "pkg2/C2.html", "Method Summary"}}; - - private static final String[] ARGS1 = - new String[] { - "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"}; - private static final String[] ARGS2 = - new String[] { - "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"}; - - /** - * The entry point of the test. - * @param args the array of command line arguments. - */ - public static void main(String[] args) { + public static void main(String... args) throws Exception { TestHtmlStrongTag tester = new TestHtmlStrongTag(); - tester.run(ARGS1, TEST1, NEGATED_TEST1); - tester.run(ARGS2, TEST2, NEGATED_TEST2); - tester.printSummary(); + tester.runTests(); + } + + @Test + void test1() { + javadoc("-d", "out-1", + "-sourcepath", testSrc, + "pkg1"); + checkExit(Exit.OK); + + checkOutput("pkg1/C1.html", true, + "See Also:"); + + checkOutput("pkg1/C1.html", false, + "Method Summary", + ""); + + checkOutput("pkg1/package-summary.html", false, + "Class Summary"); + } + + @Test + void test2() { + javadoc("-d", "out-2", + "-sourcepath", testSrc, + "pkg2"); + checkExit(Exit.OK); + + checkOutput("pkg2/C2.html", true, + "Comments:"); + + checkOutput("pkg2/C2.html", false, + "Method Summary"); } } diff --git a/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java b/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java index b211b7c71e8..9f719a9d278 100644 --- a/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java +++ b/langtools/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java @@ -26,69 +26,59 @@ * @bug 8008164 * @summary Test styles on HTML tables generated by javadoc. * @author Bhavesh Patel - * @library ../lib/ - * @build JavadocTester TestHtmlTableStyles + * @library ../lib + * @build JavadocTester * @run main TestHtmlTableStyles */ public class TestHtmlTableStyles extends JavadocTester { - //Input for string search tests. - private static final String[][] TEST = { - { "pkg1/TestTable.html", - "