langtools/test/com/sun/javadoc/testIndex/TestIndex.java
changeset 24399 af1a0220d0fa
parent 24072 e7549dcbc4af
child 29429 964498d4dcec
--- a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java	Fri May 09 23:31:05 2014 +0200
+++ b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java	Fri May 09 15:37:12 2014 -0700
@@ -28,64 +28,53 @@
  *           Also test that index-all.html has the appropriate output.
  *           Test for unnamed package in index.
  * @author   jamieh
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestIndex
  * @run main TestIndex
  */
 
 public class TestIndex extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg", SRC_DIR + "/NoPackage.java"
-    };
+    public static void main(String... args) throws Exception {
+        TestIndex tester = new TestIndex();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg", testSrc("NoPackage.java"));
+        checkExit(Exit.OK);
+
         //Make sure the horizontal scroll bar does not appear in class frame.
-        { "index.html",
-            "<frame src=\"overview-summary.html\" name=\"classFrame\" title=\"" +
-            "Package, class and interface descriptions\" scrolling=\"yes\">"},
+        checkOutput("index.html", true,
+                "<frame src=\"overview-summary.html\" name=\"classFrame\" title=\""
+                + "Package, class and interface descriptions\" scrolling=\"yes\">");
 
         //Test index-all.html
-        { "index-all.html",
-            "<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">C</span></a>" +
-            " - Class in <a href=\"pkg/package-summary.html\">pkg</a>"},
-        { "index-all.html",
-            "<a href=\"pkg/Interface.html\" title=\"interface in pkg\">" +
-            "<span class=\"typeNameLink\">Interface</span></a> - Interface in " +
-            "<a href=\"pkg/package-summary.html\">pkg</a>"},
-        { "index-all.html",
-            "<a href=\"pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
-            "<span class=\"typeNameLink\">AnnotationType</span></a> - Annotation Type in " +
-            "<a href=\"pkg/package-summary.html\">pkg</a>"},
-        { "index-all.html",
-            "<a href=\"pkg/Coin.html\" title=\"enum in pkg\">" +
-            "<span class=\"typeNameLink\">Coin</span></a> - Enum in " +
-            "<a href=\"pkg/package-summary.html\">pkg</a>"},
-        { "index-all.html",
-            "Class in <a href=\"package-summary.html\">&lt;Unnamed&gt;</a>"},
-        { "index-all.html",
-            "<dl>\n" +
-            "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#Java\">" +
-            "Java</a></span> - Static variable in class pkg.<a href=\"pkg/C.html\" " +
-            "title=\"class in pkg\">C</a></dt>\n" +
-            "<dd>&nbsp;</dd>\n" +
-            "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#JDK\">JDK</a></span> " +
-            "- Static variable in class pkg.<a href=\"pkg/C.html\" title=\"class in pkg\">" +
-            "C</a></dt>\n" +
-            "<dd>&nbsp;</dd>\n" +
-            "</dl>"},
-    };
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestIndex tester = new TestIndex();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("index-all.html", true,
+                "<a href=\"pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">C</span></a>"
+                + " - Class in <a href=\"pkg/package-summary.html\">pkg</a>",
+                "<a href=\"pkg/Interface.html\" title=\"interface in pkg\">"
+                + "<span class=\"typeNameLink\">Interface</span></a> - Interface in "
+                + "<a href=\"pkg/package-summary.html\">pkg</a>",
+                "<a href=\"pkg/AnnotationType.html\" title=\"annotation in pkg\">"
+                + "<span class=\"typeNameLink\">AnnotationType</span></a> - Annotation Type in "
+                + "<a href=\"pkg/package-summary.html\">pkg</a>",
+                "<a href=\"pkg/Coin.html\" title=\"enum in pkg\">"
+                + "<span class=\"typeNameLink\">Coin</span></a> - Enum in "
+                + "<a href=\"pkg/package-summary.html\">pkg</a>",
+                "Class in <a href=\"package-summary.html\">&lt;Unnamed&gt;</a>",
+                "<dl>\n"
+                + "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#Java\">"
+                + "Java</a></span> - Static variable in class pkg.<a href=\"pkg/C.html\" "
+                + "title=\"class in pkg\">C</a></dt>\n"
+                + "<dd>&nbsp;</dd>\n"
+                + "<dt><span class=\"memberNameLink\"><a href=\"pkg/C.html#JDK\">JDK</a></span> "
+                + "- Static variable in class pkg.<a href=\"pkg/C.html\" title=\"class in pkg\">"
+                + "C</a></dt>\n"
+                + "<dd>&nbsp;</dd>\n"
+                + "</dl>");
     }
 }