changeset 3346:94aca852a4d0

8038730: Clean up the way JavadocTester is invoked, and checks for errors. Reviewed-by: ksrini, sogoel, bpatel
author jjg
date Fri, 09 May 2014 15:37:12 -0700
parents 7e5918873ba1
children 615a70db794b
files test/com/sun/javadoc/5093723/T5093723.java test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java test/com/sun/javadoc/AccessFrameTitle/AccessFrameTitle.java test/com/sun/javadoc/AccessH1/AccessH1.java test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java test/com/sun/javadoc/AccessSummary/AccessSummary.java test/com/sun/javadoc/AuthorDD/AuthorDD.java test/com/sun/javadoc/DocRootSlash/DocRootSlash.java test/com/sun/javadoc/InheritDocForUserTags/DocTest.java test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java test/com/sun/javadoc/MetaTag/MetaTag.java test/com/sun/javadoc/PackagesHeader/PackagesHeader.java test/com/sun/javadoc/T6735320/T6735320.java test/com/sun/javadoc/ValidHtml/ValidHtml.java test/com/sun/javadoc/VersionNumber/VersionNumber.java test/com/sun/javadoc/WindowTitles/WindowTitles.java test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java test/com/sun/javadoc/dupThrowsTags/TestDupThrowsTags.java test/com/sun/javadoc/lib/JavadocTester.java test/com/sun/javadoc/testAbsLinkPath/TestAbsLinkPath.java test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java test/com/sun/javadoc/testBackSlashInLink/TestBackSlashInLink.java test/com/sun/javadoc/testBadPackageFileInJar/TestBadPackageFileInJar.java test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java test/com/sun/javadoc/testBaseClass/TestBaseClass.java test/com/sun/javadoc/testBreakIterator/TestBreakIterator.java test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java test/com/sun/javadoc/testCharset/TestCharset.java test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java test/com/sun/javadoc/testClassTree/TestClassTree.java test/com/sun/javadoc/testCmndLineClass/TestCmndLineClass.java test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java test/com/sun/javadoc/testConstantValuesPage/TestConstantValuesPage.java test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java test/com/sun/javadoc/testConstructors/TestConstructors.java test/com/sun/javadoc/testCustomTag/TestCustomTag.java test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java test/com/sun/javadoc/testDocEncoding/TestDocEncoding.java test/com/sun/javadoc/testDocErrorReporter/TestDocErrorReporter.java test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java test/com/sun/javadoc/testDocFiles/TestDocFiles.java test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java test/com/sun/javadoc/testEncoding/TestEncoding.java test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java test/com/sun/javadoc/testGroupOption/TestGroupOption.java test/com/sun/javadoc/testHeadings/TestHeadings.java test/com/sun/javadoc/testHelpFile/TestHelpFile.java test/com/sun/javadoc/testHelpOption/TestHelpOption.java test/com/sun/javadoc/testHiddenMembers/TestHiddenMembers.java test/com/sun/javadoc/testHref/TestHref.java test/com/sun/javadoc/testHrefInDocComment/TestHrefInDocComment.java test/com/sun/javadoc/testHtmlComments/TestHtmlComments.java test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java test/com/sun/javadoc/testIndentation/TestIndentation.java test/com/sun/javadoc/testIndex/TestIndex.java test/com/sun/javadoc/testInlineLinkLabel/TestInlineLinkLabel.java test/com/sun/javadoc/testInterface/TestInterface.java test/com/sun/javadoc/testJavaFX/TestJavaFX.java test/com/sun/javadoc/testJavascript/TestJavascript.java test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java test/com/sun/javadoc/testLegacyTaglet/TestLegacyTaglet.java test/com/sun/javadoc/testLinkOption/TestBadLinkOption.java test/com/sun/javadoc/testLinkOption/TestLinkOption.java test/com/sun/javadoc/testLinkOption/TestNewLineInLink.java test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java test/com/sun/javadoc/testLinkToSerialForm/TestLinkToSerialForm.java test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java test/com/sun/javadoc/testMethodTypes/TestMethodTypes.java test/com/sun/javadoc/testModifier/TestModifier.java test/com/sun/javadoc/testNavigation/TestNavigation.java test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java test/com/sun/javadoc/testNestedInlineTag/TestNestedInlineTag.java test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java test/com/sun/javadoc/testNoPackagesFile/TestNoPackagesFile.java test/com/sun/javadoc/testNonFrameWarning/TestNonFrameWarning.java test/com/sun/javadoc/testNotifications/TestNotifications.java test/com/sun/javadoc/testOptions/TestOptions.java test/com/sun/javadoc/testOrdering/TestOrdering.java test/com/sun/javadoc/testOverridenMethods/TestMultiInheritence.java test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java test/com/sun/javadoc/testPackagePage/TestPackagePage.java test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java test/com/sun/javadoc/testProfiles/TestProfiles.java test/com/sun/javadoc/testProfiles/TestProfilesConfiguration.java test/com/sun/javadoc/testRecurseSubPackages/TestRecurseSubPackages.java test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java test/com/sun/javadoc/testReturnTag/TestReturnTag.java test/com/sun/javadoc/testSeeTag/TestSeeTag.java test/com/sun/javadoc/testSerialVersionUID/TestSerialVersionUID.java test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java test/com/sun/javadoc/testSimpleTagExclude/TestSimpleTagExclude.java test/com/sun/javadoc/testSimpleTagInherit/TestSimpleTagInherit.java test/com/sun/javadoc/testSinceTag/TestSinceTag.java test/com/sun/javadoc/testSingleQuotedLink/TestSingleQuotedLink.java test/com/sun/javadoc/testSourceTab/TestSourceTab.java test/com/sun/javadoc/testStylesheet/TestStylesheet.java test/com/sun/javadoc/testSubTitle/TestSubTitle.java test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java test/com/sun/javadoc/testSuperclassInSerialForm/TestSuperClassInSerialForm.java test/com/sun/javadoc/testSupplementary/TestSupplementary.java test/com/sun/javadoc/testTagHolderMethod/TestTagHolderMethod.java test/com/sun/javadoc/testTagInheritence/TestTagInheritence.java test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java test/com/sun/javadoc/testTagOutput/TestTagOutput.java test/com/sun/javadoc/testTaglets/TestTaglets.java test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java test/com/sun/javadoc/testThrowsInheritence/TestThrowsTagInheritence.java test/com/sun/javadoc/testThrowsTag/TestThrowsTag.java test/com/sun/javadoc/testTitleInHref/TestTitleInHref.java test/com/sun/javadoc/testTopOption/TestTopOption.java test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java test/com/sun/javadoc/testTypeParams/TestTypeParameters.java test/com/sun/javadoc/testUnnamedPackage/TestUnnamedPackage.java test/com/sun/javadoc/testUseOption/TestUseOption.java test/com/sun/javadoc/testValueTag/TestValueTag.java test/com/sun/javadoc/testWarnBadParamNames/TestWarnBadParamNames.java test/com/sun/javadoc/testWarnings/TestWarnings.java test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java test/com/sun/javadoc/testXOption/TestXOption.java test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java
diffstat 144 files changed, 7079 insertions(+), 9315 deletions(-) [+]
line wrap: on
line diff
--- a/test/com/sun/javadoc/5093723/T5093723.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/5093723/T5093723.java	Fri May 09 15:37:12 2014 -0700
@@ -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) throws Exception {
+        T5093723 tester = new T5093723();
+        tester.runTests();
+    }
 
-    public static void main(String... args) {
-        T5093723 tester = new T5093723();
-        if (tester.runJavadoc(ARGS) != 0)
-          throw new AssertionError("non-zero return code from javadoc");
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-Xdoclint:none",
+                testSrc("DocumentedClass.java"),
+                testSrc("UndocumentedClass.java"));
+        checkExit(Exit.OK);
     }
 }
--- a/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java	Fri May 09 15:37:12 2014 -0700
@@ -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
-            {
-"<li><a href=\"../../p1/C.html\" title=\"class in p1\">p1.C</a></li>",
-                     TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
-
-            // Test the second line of the class tree
-            {
-"<li><a href=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</a></li>",
-                     TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
-
-            // Test the third line of the class tree
-            {
-"<li>p1.subpkg.SSC</li>",
-                     TMPDEST_DIR1 + "p1/subpkg/SSC.html" },
-
-        };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.indexOf(stringToFind);
+        checkOutput("p1/subpkg/SSC.html", true,
+                // Test the top line of the class tree
+                "<li><a href=\"../../p1/C.html\" title=\"class in p1\">p1.C</a></li>",
+                // Test the second line of the class tree
+                "<li><a href=\"../../p1/SC.html\" title=\"class in p1\">p1.SC</a></li>",
+                // Test the third line of the class tree
+                "<li>p1.subpkg.SSC</li>");
     }
 }
--- a/test/com/sun/javadoc/AccessFrameTitle/AccessFrameTitle.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/AccessFrameTitle/AccessFrameTitle.java	Fri May 09 15:37:12 2014 -0700
@@ -26,141 +26,32 @@
  * @bug 4636655
  * @summary  Add title attribute to <FRAME> tags for accessibility
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main AccessFrameTitle
  */
 
+public class AccessFrameTitle 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 AccessFrameTitle {
-
-    private static final String BUGID = "4636655";
-    private static final String BUGNAME = "AccessFrameTitle";
-    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", "p2"});
-        runTestsOnHTML(testArray);
-
-        printSummary();
+    public static void main(String... args) throws Exception {
+        AccessFrameTitle tester = new AccessFrameTitle();
+        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", "p2");
+        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 = {
-
-            // Testing only for the presence of the title attributes.
-            // To make this test more robust, only
-            // the initial part of each title string is tested for,
-            // in case the ending part of the string later changes
-
-            { "title=\"All classes and interfaces (except non-static nested types)\"",
-                     TMPDEST_DIR1 + "index.html" },
-
-            { "title=\"All Packages\"",
-                     TMPDEST_DIR1 + "index.html" },
-
-            { "title=\"Package, class and interface descriptions\"",
-                     TMPDEST_DIR1 + "index.html" },
-
-        };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.indexOf(stringToFind);
+        // Testing only for the presence of the title attributes.
+        // To make this test more robust, only
+        // the initial part of each title string is tested for,
+        // in case the ending part of the string later changes
+        checkOutput("index.html", true,
+                "title=\"All classes and interfaces (except non-static nested types)\"",
+                "title=\"All Packages\"",
+                "title=\"Package, class and interface descriptions\"");
     }
 }
--- a/test/com/sun/javadoc/AccessH1/AccessH1.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/AccessH1/AccessH1.java	Fri May 09 15:37:12 2014 -0700
@@ -26,141 +26,35 @@
  * @bug 4636667 7052425 8016549
  * @summary  Use <H1, <H2>, and <H3> in proper sequence for accessibility
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main AccessH1
  */
 
 
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
+public class AccessH1 extends JavadocTester {
 
-
-/**
- * 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 AccessH1 {
-
-    protected static final String NL = System.getProperty("line.separator");
-
-    private static final String BUGID = "4636667-7052425";
-    private static final String BUGNAME = "AccessH1";
-    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,
-                                 "-doctitle", "Document Title",
-                                 "-sourcepath", srcdir,
-                                 "p1", "p2"});
-        runTestsOnHTML(testArray);
-
-        printSummary();
+    public static void main(String... args) throws Exception {
+        AccessH1 tester = new AccessH1();
+        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",
+                "-doctitle", "Document Title",
+                "-sourcepath", testSrc,
+                "p1", "p2");
+        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 style sheet
-        {
-            "h1 {\n" +
-            "    font-size:20px;\n" +
-            "}",
-            TMPDEST_DIR1 + "stylesheet.css"
-        },
+        checkOutput("stylesheet.css", true,
+                "h1 {\n"
+                + "    font-size:20px;\n"
+                + "}");
+
         // Test the doc title in the overview page
-        {
-            "<h1 class=\"title\">Document Title</h1>",
-            TMPDEST_DIR1 + "overview-summary.html"
-        }
-    };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.replace(NL, "\n").indexOf(stringToFind);
+        checkOutput("overview-summary.html", true,
+                "<h1 class=\"title\">Document Title</h1>");
     }
 }
--- a/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java	Fri May 09 15:37:12 2014 -0700
@@ -26,150 +26,40 @@
  * @bug 4638136 7198273 8025633
  * @summary  Add ability to skip over nav bar for accessibility
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main AccessSkipNav
  */
 
+public class AccessSkipNav 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 AccessSkipNav {
-
-    protected static final String NL = System.getProperty("line.separator");
-
-    private static final String BUGID = "4638136 - 7198273";
-    private static final String BUGNAME = "AccessSkipNav";
-    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", "p2"});
-        runTestsOnHTML(testArray);
-
-        printSummary();
+    public static void main(String... args) throws Exception {
+        AccessSkipNav tester = new AccessSkipNav();
+        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", "p2");
+        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 = {
+        // Testing only for the presence of the <a href> and <a name>
+        checkOutput("p1/C1.html", true,
+                // Top navbar <a href>
+                "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
+                // Top navbar <a name>
+                "<a name=\"skip.navbar.top\">\n"
+                + "<!--   -->\n"
+                + "</a>",
+                // Bottom navbar <a href>
+                "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
+                // Bottom navbar <a name>
+                "<a name=\"skip.navbar.bottom\">\n"
+                + "<!--   -->\n"
+                + "</a>");
 
-            // Testing only for the presence of the <a href> and <a name>
 
-            // Top navbar <a href>
-            { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
-                     TMPDEST_DIR1 + "p1/C1.html" },
-
-            // Top navbar <a name>
-            { "<a name=\"skip.navbar.top\">\n" +
-                      "<!--   -->\n" +
-                      "</a>",
-                     TMPDEST_DIR1 + "p1/C1.html" },
-
-            // Bottom navbar <a href>
-            { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
-                     TMPDEST_DIR1 + "p1/C1.html" },
-
-            // Bottom navbar <a name>
-            { "<a name=\"skip.navbar.bottom\">\n" +
-                      "<!--   -->\n" +
-                      "</a>",
-                     TMPDEST_DIR1 + "p1/C1.html" }
-        };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.replace(NL, "\n").indexOf(stringToFind);
     }
 }
--- a/test/com/sun/javadoc/AccessSummary/AccessSummary.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/AccessSummary/AccessSummary.java	Fri May 09 15:37:12 2014 -0700
@@ -26,45 +26,35 @@
  * @bug      4637604 4775148
  * @summary  Test the tables for summary attribute
  * @author   dkramer
- * @library  ../lib/
+ * @library ../lib
  * @build    JavadocTester
- * @build    AccessSummary
  * @run main AccessSummary
  */
 
 public class AccessSummary extends JavadocTester {
-
-    /**
-     * Assign value for [ fileToSearch, stringToFind ]
-     */
-    private static final String[][] TESTARRAY1 = {
-
-        // Test that the summary attribute appears
-        { "overview-summary.html",
-                 "summary=\"Packages table, listing packages, and an explanation\"" },
-
-        // Test that the summary attribute appears
-        { "p1/C1.html",
-                 "summary=\"Constructor Summary table, listing constructors, and an explanation\"" },
-
-        // Test that the summary attribute appears
-        { "constant-values.html",
-                 "summary=\"Constant Field Values table, listing constant fields, and values\"" }
-    };
-
-    // First test with -header only
-    private static final String[] JAVADOC_ARGS = new String[] {
-            "-d", OUTPUT_DIR,
-            "-sourcepath", SRC_DIR,
-            "p1", "p2"};
-
     /**
      * The entry point of the test.
      * @param args the array of command line arguments.
+     * @throws Exception if the test fails
      */
-    public static void main(String[] args) {
-        JavadocTester tester = new AccessSummary();
-        tester.run(JAVADOC_ARGS,  TESTARRAY1, new String[][] {});
-        tester.printSummary();       // Necessary for string search
+    public static void main(String... args) throws Exception {
+        AccessSummary tester = new AccessSummary();
+        tester.runTests();
+    }
+
+    @Test
+    void testAccessSummary() {
+        javadoc("-d", "out", "-sourcepath", testSrc, "p1", "p2");
+        checkExit(Exit.OK);
+        checkOutput("overview-summary.html", true,
+                 "summary=\"Packages table, listing packages, and an explanation\"");
+
+        // Test that the summary attribute appears
+        checkOutput("p1/C1.html", true,
+                 "summary=\"Constructor Summary table, listing constructors, and an explanation\"");
+
+        // Test that the summary attribute appears
+        checkOutput("constant-values.html", true,
+                 "summary=\"Constant Field Values table, listing constant fields, and values\"");
     }
 }
--- a/test/com/sun/javadoc/AuthorDD/AuthorDD.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/AuthorDD/AuthorDD.java	Fri May 09 15:37:12 2014 -0700
@@ -26,143 +26,37 @@
  * @bug 4651598 8026567
  * @summary Javadoc wrongly inserts </DD> tags when using multiple @author tags
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main AuthorDD
  */
 
-
-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 AuthorDD
-{
+public class AuthorDD extends JavadocTester {
 
-    protected static final String NL = System.getProperty("line.separator");
-
-    private static final String BUGID = "4651598";
-    private static final String BUGNAME = "AuthorDD";
-
-    // 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", BUGID,
-                                 "-author",
-                                 "-version",
-                                 "-sourcepath", srcdir,
-                                 "p1"});
-        runTestsOnHTML(testArray);
-
-        printSummary();
+    public static void main(String... args) throws Exception {
+        AuthorDD tester = new AuthorDD();
+        tester.runTests();
     }
 
-    /** Run javadoc */
-    public static void runJavadoc(String[] javadocArgs) {
-        if (com.sun.tools.javadoc.Main.execute(AuthorDD.class.getClassLoader(),
-                                               javadocArgs) != 0) {
-            throw new Error("Javadoc failed to execute");
-        }
-    }
+    @Test
+    void test() {
+        // Test for all cases except the split index page
+        javadoc("-d", "out",
+                "-author",
+                "-version",
+                "-sourcepath", testSrc,
+                "p1");
+        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 single @since tag:
-
-            { "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                                  "<dd>JDK 1.0</dd>",
-                                  BUGID + "/p1/C1.html" },
-
-            // Test multiple @author tags:
-
-            { "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n" +
-                                  "<dd>Doug Kramer, Jamie, Neal</dd>",
-                                  BUGID + "/p1/C1.html" },
-
-        };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.replace(NL, "\n").indexOf(stringToFind);
+        checkOutput("p1/C1.html", true,
+                // Test single @since tag:
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+                + "<dd>JDK 1.0</dd>",
+                // Test multiple @author tags:
+                "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n"
+                + "<dd>Doug Kramer, Jamie, Neal</dd>");
     }
 }
--- a/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/DocRootSlash/DocRootSlash.java	Fri May 09 15:37:12 2014 -0700
@@ -26,13 +26,11 @@
  * @bug 4524350 4662945 4633447
  * @summary stddoclet: {@docRoot} inserts an extra trailing "/"
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main DocRootSlash
  */
 
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-import java.nio.*;
 import java.util.regex.*;
 
 /**
@@ -40,149 +38,55 @@
  * It reads each file, complete with newlines, into a string to easily
  * find strings that contain newlines.
  */
-public class DocRootSlash
-{
-    private static final String BUGID = "4524350, 4662945, or 4633447";
-    private static final String BUGNAME = "DocRootSlash";
-    private static final String TMPDIR_STRING1 = "./docs1/";
+public class DocRootSlash extends JavadocTester {
 
-    // Test number.  Needed because runResultsOnHTMLFile is run twice, and subtestNum
-    // should increment across test runs.
-    public static int subtestNum = 0;
-    public static int numOfSubtestsPassed = 0;
+    public static void main(String... args) throws Exception {
+        DocRootSlash tester = new DocRootSlash();
+        tester.runTests();
+    }
 
-    // Entry point
-    public static void main(String[] args) {
-
+    @Test
+    void test() {
         // Directory that contains source files that javadoc runs on
         String srcdir = System.getProperty("test.src", ".");
 
-        runJavadoc(new String[] {"-d", TMPDIR_STRING1,
-                                 "-Xdoclint:none",
-                                 "-overview", (srcdir + "/overview.html"),
-                                 "-header", "<A HREF=\"{@docroot}/package-list\">{&#064;docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{&#064;docRoot}</A>",
-                                 "-sourcepath", srcdir,
-                                 "p1", "p2"});
-        runTestsOnHTMLFiles(filenameArray);
+        javadoc("-d", "out",
+                "-Xdoclint:none",
+                "-overview", (srcdir + "/overview.html"),
+                "-header", "<A HREF=\"{@docroot}/package-list\">{&#064;docroot}</A> <A HREF=\"{@docRoot}/help-doc\">{&#064;docRoot}</A>",
+                "-sourcepath", srcdir,
+                "p1", "p2");
 
-        printSummary();
-    }
-
-    /** Run javadoc */
-    public static void runJavadoc(String[] javadocArgs) {
-        if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
-            throw new Error("Javadoc failed to execute");
-        }
-    }
-
-    /**  The array of filenames to test */
-    private static final String[] filenameArray = {
-        TMPDIR_STRING1 + "p1/C1.html" ,
-        TMPDIR_STRING1 + "p1/package-summary.html",
-        TMPDIR_STRING1 + "overview-summary.html"
-    };
-
-    public static void runTestsOnHTMLFiles(String[] filenameArray) {
-        String fileString;
-
-        // Bugs 4524350 4662945
-        for (int i = 0; i < filenameArray.length; i++ ) {
-
-            // Read contents of file (whose filename is in filenames) into a string
-            fileString = readFileToString(filenameArray[i]);
-
-            System.out.println("\nSub-tests for file: " + filenameArray[i]
-                                + " --------------");
-
-            // Loop over all tests in a single file
-            for ( int j = 0; j < 11; j++ ) {
-                subtestNum += 1;
-
-                // Compare actual to expected string for a single subtest
-                compareActualToExpected(fileString);
-            }
-        }
+        checkFiles(
+                "p1/C1.html" ,
+                "p1/package-summary.html",
+                "overview-summary.html");
 
         // Bug 4633447: Special test for overview-frame.html
         // Find two strings in file "overview-frame.html"
-        String filename = TMPDIR_STRING1 + "overview-frame.html";
-        fileString = readFileToString(filename);
-
-        // Find first string <A HREF="./package-list"> in overview-frame.html
-        subtestNum += 1;
-        String stringToFind = "<A HREF=\"./package-list\">";
-        String result;
-        if ( fileString.indexOf(stringToFind) == -1 ) {
-            result = "FAILED";
-        } else {
-            result = "succeeded";
-            numOfSubtestsPassed += 1;
-        }
-        System.out.println("\nSub-test " + (subtestNum)
-            + " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
-            + "when searching for:\n"
-            + stringToFind + "\n"
-            + "in file " + filename);
-
-        // Find second string <A HREF="./help-doc"> in overview-frame.html
-        subtestNum += 1;
-        stringToFind = "<A HREF=\"./help-doc\">";
-        if ( fileString.indexOf(stringToFind) == -1 ) {
-            result = "FAILED";
-        } else {
-            result = "succeeded";
-            numOfSubtestsPassed += 1;
-        }
-        System.out.println("\nSub-test " + (subtestNum)
-            + " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
-            + "when searching for:\n"
-            + stringToFind + "\n"
-            + "in file " + filename);
+        checkOutput("overview-frame.html", true,
+                "<A HREF=\"./package-list\">",
+                "<A HREF=\"./help-doc\">");
     }
 
-    public static void printSummary() {
-        System.out.println("");
-        if ( numOfSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numOfSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numOfSubtestsPassed) + " of " + (subtestNum)
-                            + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
+    void checkFiles(String... filenameArray) {
+        int count = 0;
 
-    // Read the contents of the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
+        for (String f : filenameArray) {
+            // Read contents of file into a string
+            String fileString = readFile(f);
+            System.out.println("\nSub-tests for file: " + f + " --------------");
+            // Loop over all tests in a single file
+            for ( int j = 0; j < 11; j++ ) {
+
+                // Compare actual to expected string for a single subtest
+                compareActualToExpected(++count, fileString);
             }
-
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
         }
     }
 
     /**
-     * Regular expression pattern matching code adapted from Eric's
-     * /java/pubs/dev/linkfix/src/LinkFix.java
+     * Regular expression pattern matching code
      *
      * Prefix Pattern:
      * flag   (?i)            (case insensitive, so "a href" == "A HREF" and all combinations)
@@ -197,34 +101,33 @@
      * group4 (.*?)           (label - zero or more characters)
      * group5 (</a>)          (end tag)
      */
-    static String prefix = "(?i)(<a\\s+href=";    // <a href=     (start group1)
-    static String ref1   = "\")([^\"]*)(\".*?>)"; // doublequotes (end group1, group2, group3)
-    static String ref2   = ")(\\S+?)([^<>]*>)";   // no quotes    (end group1, group2, group3)
-    static String label  = "(.*?)";               // text label   (group4)
-    static String end    = "(</a>)";              // </a>         (group5)
+    private static final String prefix = "(?i)(<a\\s+href=";    // <a href=     (start group1)
+    private static final String ref1   = "\")([^\"]*)(\".*?>)"; // doublequotes (end group1, group2, group3)
+    private static final String ref2   = ")(\\S+?)([^<>]*>)";   // no quotes    (end group1, group2, group3)
+    private static final String label  = "(.*?)";               // text label   (group4)
+    private static final String end    = "(</a>)";              // </a>         (group5)
 
     /**
      * Compares the actual string to the expected string in the specified string
-     * str   String to search through
+     * @param str   String to search through
      */
-    static void compareActualToExpected(String str) {
-        // Pattern must be compiled each run because subtestNum is incremented
+    void compareActualToExpected(int count, String str) {
+        checking("comparison for " + str);
+
+        // Pattern must be compiled each run because numTestsRun is incremented
         Pattern actualLinkPattern1 =
-            Pattern.compile("Sub-test " + subtestNum + " Actual: " + prefix + ref1, Pattern.DOTALL);
+            Pattern.compile("Sub-test " + count + " Actual: " + prefix + ref1, Pattern.DOTALL);
         Pattern expectLinkPattern1 =
-            Pattern.compile("Sub-test " + subtestNum + " Expect: " + prefix + ref1, Pattern.DOTALL);
+            Pattern.compile("Sub-test " + count + " Expect: " + prefix + ref1, Pattern.DOTALL);
         // Pattern linkPattern2 = Pattern.compile(prefix + ref2 + label + end, Pattern.DOTALL);
 
-        CharBuffer charBuffer = CharBuffer.wrap(str);
-        Matcher actualLinkMatcher1 = actualLinkPattern1.matcher(charBuffer);
-        Matcher expectLinkMatcher1 = expectLinkPattern1.matcher(charBuffer);
-        String result;
-        if ( expectLinkMatcher1.find() && actualLinkMatcher1.find() ) {
+        Matcher actualLinkMatcher1 = actualLinkPattern1.matcher(str);
+        Matcher expectLinkMatcher1 = expectLinkPattern1.matcher(str);
+        if (expectLinkMatcher1.find() && actualLinkMatcher1.find()) {
             String expectRef = expectLinkMatcher1.group(2);
             String actualRef = actualLinkMatcher1.group(2);
-            if ( actualRef.equals(expectRef) ) {
-                result = "succeeded";
-                numOfSubtestsPassed += 1;
+            if (actualRef.equals(expectRef)) {
+                passed(expectRef);
                 // System.out.println("pattern:   " + actualLinkPattern1.pattern());
                 // System.out.println("actualRef: " + actualRef);
                 // System.out.println("group0:    " + actualLinkMatcher1.group());
@@ -233,15 +136,13 @@
                 // System.out.println("group3:    " + actualLinkMatcher1.group(3));
                 // System.exit(0);
             } else {
-                result = "FAILED";
+                failed("\n"
+                        + "Actual: \"" + actualRef + "\"\n"
+                        + "Expect: \"" + expectRef + "\"");
             }
-            System.out.println("\nSub-test " + (subtestNum)
-                + " for bug " + BUGID + " (" + BUGNAME + ") " + result + "\n"
-                + "Actual: \"" + actualRef + "\"" + "\n"
-                + "Expect: \"" + expectRef + "\"");
         } else {
-            System.out.println("Didn't find <A HREF> that fits the pattern: "
-                  + expectLinkPattern1.pattern() );
+            failed("Didn't find <A HREF> that fits the pattern: "
+                    + expectLinkPattern1.pattern());
         }
     }
 }
--- a/test/com/sun/javadoc/InheritDocForUserTags/DocTest.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/InheritDocForUserTags/DocTest.java	Fri May 09 15:37:12 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,11 +26,11 @@
  * @bug 8008768
  * @summary Using {@inheritDoc} in simple tag defined via -tag fails
  * @author Mike Duigou
+ * @library ../lib
+ * @build JavadocTester
  * @run main DocTest
  */
 
-import java.io.*;
-
 /**
  * DocTest documentation.
  *
@@ -38,41 +38,27 @@
  * @implSpec DocTest implementation spec.
  * @implNote DocTest implementation note.
  */
-public class DocTest {
+public class DocTest extends JavadocTester {
     public static void main(String... args) throws Exception {
-        String[] javadoc_args = {
-            "-verbose",
-            "-d", "DocTest",
-            "-tag", "apiNote:optcm:<em>API Note</em>",
-            "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:",
-            "-tag", "implNote:optcm:<em>Implementation Note</em>:",
-            "-package",
-            new File(System.getProperty("test.src"), "DocTest.java").getPath()
-        };
+        DocTest tester = new DocTest();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-verbose",
+                "-d", "DocTest",
+                "-tag", "apiNote:optcm:<em>API Note</em>",
+                "-tag", "implSpec:optcm:<em>Implementation Requirements</em>:",
+                "-tag", "implNote:optcm:<em>Implementation Note</em>:",
+                "-package",
+                testSrc("DocTest.java")
+        );
+        checkExit(Exit.OK);
 
         // javadoc does not report an exit code for an internal exception (!)
         // so monitor stderr for stack dumps.
-        PrintStream prevErr = System.err;
-        ByteArrayOutputStream err_baos = new ByteArrayOutputStream();
-        PrintStream err_ps = new PrintStream(err_baos);
-        System.setErr(err_ps);
-
-        int rc;
-        try {
-            rc = com.sun.tools.javadoc.Main.execute(javadoc_args);
-        } finally {
-            err_ps.close();
-            System.setErr(prevErr);
-        }
-
-        String err = err_baos.toString();
-        System.err.println(err);
-
-        if (rc != 0)
-            throw new Exception("javadoc exited with rc=" + rc);
-
-        if (err.contains("at com.sun."))
-            throw new Exception("javadoc output contains stack trace");
+        checkOutput(Output.STDERR, false, "at com.sun");
     }
 
     /**
--- a/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/JavascriptWinTitle/JavascriptWinTitle.java	Fri May 09 15:37:12 2014 -0700
@@ -27,172 +27,49 @@
  * @summary  Javascript IE load error when linked by -linkoffline
  *           Window title shouldn't change when loading left frames (javascript)
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main JavascriptWinTitle
  */
 
+public class JavascriptWinTitle 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 JavascriptWinTitle {
-
-    protected static final String NL = System.getProperty("line.separator");
-
-    private static final String BUGID = "4645058";
-    private static final String BUGNAME = "JavascriptWinTitle";
-    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,
-                                 "-doctitle", "Document Title",
-                                 "-windowtitle", "Window Title",
-                                 "-overview", (srcdir + "/overview.html"),
-                                 "-linkoffline",
-                                    "http://java.sun.com/j2se/1.4/docs/api", srcdir,
-                                 "-sourcepath", srcdir,
-                                 "p1", "p2"});
-        runTestsOnHTML(testArray);
-
-        printSummary();
+    public static void main(String... args) throws Exception {
+        JavascriptWinTitle tester = new JavascriptWinTitle();
+        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",
+                "-doctitle", "Document Title",
+                "-windowtitle", "Window Title",
+                "-overview", testSrc("overview.html"),
+                "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api", testSrc,
+                "-sourcepath", testSrc,
+                "p1", "p2");
+        checkExit(Exit.OK);
+        checkOutput("overview-summary.html", true,
+                "<script type=\"text/javascript\">",
+                "<body>");
 
-    /**
-     * Assign value for [ stringToFind, filename ]
-     * NOTE: The standard doclet uses the same separator "\n" for all OS's
-     */
-    private static final String[][] testArray = {
+        // Test that "onload" is not present in BODY tag:
+        checkOutput("p1/package-summary.html", true, "<body>");
+        checkOutput("overview-frame.html", true, "<body>");
+        checkOutput("allclasses-frame.html", true, "<body>");
+        checkOutput("p1/package-frame.html", true, "<body>");
 
-            // Test the javascript "type" attribute is present:
-            {  "<script type=\"text/javascript\">",
-                     TMPDEST_DIR1 + "overview-summary.html"  },
-
-            // Test onload is absent:
-            {  "<body>",
-                     TMPDEST_DIR1 + "overview-summary.html"  },
-
-            // Test onload is present:
-            {  "<body>",
-                     TMPDEST_DIR1 + "/p1/package-summary.html"  },
-
-            // Test that "onload" is not present in BODY tag:
-            {   "<body>",
-                     TMPDEST_DIR1 + "overview-frame.html"  },
-
-            // Test that "onload" is not present in BODY tag:
-            {   "<body>",
-                     TMPDEST_DIR1 + "allclasses-frame.html"  },
-
-            // Test that "onload" is not present in BODY tag:
-            {   "<body>",
-                     TMPDEST_DIR1 + "/p1/package-frame.html"  },
-
-            // Test that win title javascript is followed by NOSCRIPT code.
-            {"<script type=\"text/javascript\"><!--\n" +
-            "    try {\n" +
-            "        if (location.href.indexOf('is-external=true') == -1) {\n" +
-            "            parent.document.title=\"C (Window Title)\";\n" +
-            "        }\n" +
-            "    }\n" +
-            "    catch(err) {\n" +
-            "    }\n" +
-            "//-->\n" +
-            "</script>",
-             TMPDEST_DIR1 + "/p1/C.html"
-            }
-
-        };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.replace(NL, "\n").indexOf(stringToFind);
+        // Test that win title javascript is followed by NOSCRIPT code.
+        checkOutput("p1/C.html", true,
+                "<script type=\"text/javascript\"><!--\n"
+                + "    try {\n"
+                + "        if (location.href.indexOf('is-external=true') == -1) {\n"
+                + "            parent.document.title=\"C (Window Title)\";\n"
+                + "        }\n"
+                + "    }\n"
+                + "    catch(err) {\n"
+                + "    }\n"
+                + "//-->\n"
+                + "</script>");
     }
 }
--- a/test/com/sun/javadoc/MetaTag/MetaTag.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/MetaTag/MetaTag.java	Fri May 09 15:37:12 2014 -0700
@@ -21,114 +21,94 @@
  * questions.
  */
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
 /*
  * @test
  * @bug      4034096 4764726 6235799
  * @summary  Add support for HTML keywords via META tag for
  *           class and member names to improve API search
  * @author   dkramer
- * @library  ../lib/
+ * @library ../lib
  * @build    JavadocTester
- * @build    MetaTag
  * @run main MetaTag
  */
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
 public class MetaTag extends JavadocTester {
 
-    //Test information.
-    private static final SimpleDateFormat m_dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR,
-        "-sourcepath", SRC_DIR,
-        "-keywords",
-        "-doctitle", "Sample Packages",
-        "p1", "p2"
-    };
-
-    private static final String[] ARGS_NO_TIMESTAMP_NO_KEYWORDS = new String[] {
-        "-d", OUTPUT_DIR + "-2",
-        "-sourcepath", SRC_DIR,
-        "-notimestamp",
-        "-doctitle", "Sample Packages",
-        "p1", "p2"
-    };
-
-    //Input for string search tests.
-    private static final String[][] TEST = {
-
-        { "p1/C1.html",
-           "<meta name=\"keywords\" content=\"p1.C1 class\">" },
-
-        { "p1/C1.html",
-           "<meta name=\"keywords\" content=\"field1\">" },
-
-        { "p1/C1.html",
-           "<meta name=\"keywords\" content=\"field2\">" },
-
-        { "p1/C1.html",
-           "<meta name=\"keywords\" content=\"method1()\">" },
-
-        { "p1/C1.html",
-           "<meta name=\"keywords\" content=\"method2()\">" },
-
-        { "p1/package-summary.html",
-           "<meta name=\"keywords\" content=\"p1 package\">" },
-
-        { "overview-summary.html",
-           "<meta name=\"keywords\" content=\"Overview, Sample Packages\">" },
-
-        //NOTE: Hopefully, this regression test is not run at midnight.  If the output
-        //was generated yesterday and this test is run today, the test will fail.
-        { "overview-summary.html",
-           "<meta name=\"date\" "
-                            + "content=\"" + m_dateFormat.format(new Date()) + "\">"},
-    };
-
-    private static final String[][] NEGATED_TEST2 = {
-        //No keywords when -keywords is not used.
-        { "p1/C1.html",
-           "<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">" },
-
-        { "p1/C1.html",
-           "<META NAME=\"keywords\" CONTENT=\"field1\">" },
-
-        { "p1/C1.html",
-           "<META NAME=\"keywords\" CONTENT=\"field2\">" },
-
-        { "p1/C1.html",
-           "<META NAME=\"keywords\" CONTENT=\"method1()\">" },
-
-        { "p1/C1.html",
-           "<META NAME=\"keywords\" CONTENT=\"method2()\">" },
-
-        { "p1/package-summary.html",
-           "<META NAME=\"keywords\" CONTENT=\"p1 package\">" },
-
-        { "overview-summary.html",
-           "<META NAME=\"keywords\" CONTENT=\"Overview Summary, Sample Packages\">" },
-
-        //The date metatag should not show up when -notimestamp is used.
-
-        //NOTE: Hopefully, this regression test is not run at midnight.  If the output
-        //was generated yesterday and this test is run today, the test will fail.
-        { "overview-summary.html",
-           "<META NAME=\"date\" "
-                            + "CONTENT=\"" + m_dateFormat.format(new Date()) + "\">"},
-    };
-
     /**
      * The entry point of the test.
-     * @param args the array of command line arguments.
+     * @param args the array of command line arguments
+     * @throws Exception if the test fails
      */
-    public static void main(String[] args) {
+    public static void main(String... args) throws Exception {
         MetaTag tester = new MetaTag();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.run(ARGS_NO_TIMESTAMP_NO_KEYWORDS, NO_TEST, NEGATED_TEST2);
-        tester.printSummary();
+        tester.runTests();
+    }
+
+    @Test
+    void testStandard() {
+        javadoc("-d", "out-1",
+                "-sourcepath", testSrc,
+                "-keywords",
+                "-doctitle", "Sample Packages",
+                "p1", "p2");
+
+        checkExit(Exit.OK);
+
+        checkOutput("p1/C1.html", true,
+                "<meta name=\"keywords\" content=\"p1.C1 class\">",
+                "<meta name=\"keywords\" content=\"field1\">",
+                "<meta name=\"keywords\" content=\"field2\">",
+                "<meta name=\"keywords\" content=\"method1()\">",
+                "<meta name=\"keywords\" content=\"method2()\">");
+
+        checkOutput("p1/package-summary.html", true,
+                "<meta name=\"keywords\" content=\"p1 package\">");
+
+        checkOutput("overview-summary.html", true,
+                "<meta name=\"keywords\" content=\"Overview, Sample Packages\">");
+
+        // NOTE: Hopefully, this regression test is not run at midnight.  If the output
+        // was generated yesterday and this test is run today, the test will fail.
+        checkOutput("overview-summary.html", true,
+                "<meta name=\"date\" content=\"" + date() + "\">");
+    }
+
+    @Test
+    void testNoTimestamp() {
+        javadoc("-d", "out-2",
+                "-sourcepath", testSrc,
+                "-notimestamp",
+                "-doctitle", "Sample Packages",
+                "p1", "p2");
+        checkExit(Exit.OK);
+
+        // No keywords when -keywords is not used.
+        checkOutput("p1/C1.html", false,
+                "<META NAME=\"keywords\" CONTENT=\"p1.C1 class\">",
+                "<META NAME=\"keywords\" CONTENT=\"field1\">",
+                "<META NAME=\"keywords\" CONTENT=\"field2\">",
+                "<META NAME=\"keywords\" CONTENT=\"method1()\">",
+                "<META NAME=\"keywords\" CONTENT=\"method2()\">");
+
+        checkOutput("p1/package-summary.html", false,
+                "<META NAME=\"keywords\" CONTENT=\"p1 package\">");
+
+        checkOutput("overview-summary.html", false,
+                "<META NAME=\"keywords\" CONTENT=\"Overview Summary, Sample Packages\">");
+
+        // The date metatag should not show up when -notimestamp is used.
+        // NOTE: Hopefully, this regression test is not run at midnight.  If the output
+        // was generated yesterday and this test is run today, the test will fail.
+        checkOutput("overview-summary.html", false,
+                "<META NAME=\"date\" CONTENT=\"" + date() + "\">");
+    }
+
+    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+
+    String date() {
+        return dateFormat.format(new Date());
     }
 }
--- a/test/com/sun/javadoc/PackagesHeader/PackagesHeader.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/PackagesHeader/PackagesHeader.java	Fri May 09 15:37:12 2014 -0700
@@ -28,83 +28,62 @@
  *           is present for three sets of options: (1) -header,
  *           (2) -packagesheader, and (3) -header -packagesheader
  * @author   dkramer
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    PackagesHeader
  * @run main PackagesHeader
  */
 
 public class PackagesHeader extends JavadocTester {
 
-    //Test information.
-    private static final String OUTPUT_DIR1 = OUTPUT_DIR + "-1/";
-    private static final String OUTPUT_DIR2 = OUTPUT_DIR + "-2/";
-    private static final String OUTPUT_DIR3 = OUTPUT_DIR + "-3/";
+    public static void main(String... args) throws Exception {
+        JavadocTester tester = new PackagesHeader();
+        tester.runTests();
+    }
 
-    /**
-     * Assign value for [ fileToSearch, stringToFind ]
-     */
-    private static final String[][] TESTARRAY1 = {
+    @Test
+    void testHeader() {
+        // First test with -header only
+        javadoc("-d", "out-header",
+                "-header", "Main Frame Header",
+                "-sourcepath", testSrc,
+                "p1", "p2");
+        checkExit(Exit.OK);
 
         // Test that the -header shows up in the packages frame
-        { "overview-frame.html",
-                 "Main Frame Header" }
-    };
+        checkOutput("overview-frame.html", true,
+                "Main Frame Header");
+    }
 
-    private static final String[][] TESTARRAY2 = {
+    @Test
+    void testPackagesHeader() {
+        // Second test with -packagesheader only
+        javadoc("-d", "out-packages-header",
+                "-packagesheader", "Packages Frame Header",
+                "-sourcepath", testSrc,
+                "p1", "p2");
+        checkExit(Exit.OK);
 
         // Test that the -packagesheader string shows
         // up in the packages frame
+        checkOutput("overview-frame.html", true,
+                "Packages Frame Header");
+    }
 
-        { "overview-frame.html",
-                 "Packages Frame Header" }
-    };
-
-    private static final String[][] TESTARRAY3 = {
+    @Test
+    void testBothHeaders() {
+        // Third test with both -packagesheader and -header
+        javadoc("-d", "out-both",
+                "-packagesheader", "Packages Frame Header",
+                "-header", "Main Frame Header",
+                "-sourcepath", testSrc,
+                "p1", "p2");
+        checkExit(Exit.OK);
 
         // Test that the both headers show up and are different
+        checkOutput("overview-frame.html", true,
+                "Packages Frame Header");
 
-        { "overview-frame.html",
-                 "Packages Frame Header" },
-
-        { "overview-summary.html",
-                 "Main Frame Header" }
-    };
-
-    // First test with -header only
-    private static final String[] JAVADOC_ARGS1 = new String[] {
-            "-d", OUTPUT_DIR1,
-            "-header", "Main Frame Header",
-            "-sourcepath", SRC_DIR,
-            "p1", "p2"};
-
-    // Second test with -packagesheader only
-    private static final String[] JAVADOC_ARGS2 = new String[] {
-            "-d", OUTPUT_DIR2,
-            "-packagesheader", "Packages Frame Header",
-            "-sourcepath", SRC_DIR,
-            "p1", "p2"};
-
-    // Third test with both -packagesheader and -header
-    private static final String[] JAVADOC_ARGS3 = new String[] {
-            "-d", OUTPUT_DIR3,
-            "-packagesheader", "Packages Frame Header",
-            "-header", "Main Frame Header",
-            "-sourcepath", SRC_DIR,
-            "p1", "p2"};
-
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        JavadocTester tester = new PackagesHeader();
-
-        tester.run(JAVADOC_ARGS1, TESTARRAY1, NO_TEST);
-        tester.run(JAVADOC_ARGS2, TESTARRAY2, NO_TEST);
-        tester.run(JAVADOC_ARGS3, TESTARRAY3, NO_TEST);
-
-        tester.printSummary();
+        checkOutput("overview-summary.html", true,
+                "Main Frame Header");
     }
 }
--- a/test/com/sun/javadoc/T6735320/T6735320.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/T6735320/T6735320.java	Fri May 09 15:37:12 2014 -0700
@@ -25,24 +25,24 @@
  * @test
  * @bug 6735320
  * @summary javadoc throws exception if serialField value is missing
- * @library  ../lib/
- * @build    JavadocTester T6735320
+ * @library ../lib
+ * @build JavadocTester
  * @run main T6735320
  */
+
 public class T6735320 extends JavadocTester {
 
-    private static final String[] ARGS = new String[]{
-        "-d", OUTPUT_DIR + ".out",
-        SRC_DIR + "/SerialFieldTest.java"
-    };
+    public static void main(String... args) throws Exception {
+        T6735320 tester = new T6735320();
+        tester.runTests();
+    }
 
-    public static void main(String... args) {
-        T6735320 tester = new T6735320();
-        if (tester.runJavadoc(ARGS) == 0) {
-            throw new AssertionError("zero return code from javadoc");
-        }
-        if (tester.getErrorOutput().contains("StringIndexOutOfBoundsException")) {
-            throw new AssertionError("javadoc threw StringIndexOutOfBoundsException");
-        }
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                testSrc("SerialFieldTest.java"));
+        checkExit(Exit.FAILED);
+        checkOutput(Output.STDERR, false,
+                "StringIndexOutOfBoundsException");
     }
 }
--- a/test/com/sun/javadoc/ValidHtml/ValidHtml.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/ValidHtml/ValidHtml.java	Fri May 09 15:37:12 2014 -0700
@@ -30,174 +30,52 @@
  *           <NOFRAMES> not allowed outside <FRAMESET> element
  *           HTML table tags inserted in wrong place in pakcage use page
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main ValidHtml
  */
 
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
+public class ValidHtml extends JavadocTester {
 
-/**
- * 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 ValidHtml {
+    public static void main(String... args) throws Exception {
+        ValidHtml tester = new ValidHtml();
+        tester.runTests();
+    }
 
-    protected static final String NL = System.getProperty("line.separator");
-
-    private static final String BUGID = "4275630";
-    private static final String BUGNAME = "ValidHtml";
-    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
+    void test() {
         // Test for all cases except the split index page
-        runJavadoc(new String[]{"-d", TMPDEST_DIR1,
+        javadoc("-d", "out",
                     "-doctitle", "Document Title",
                     "-windowtitle", "Window Title",
                     "-use",
-                    "-overview", (srcdir + "/overview.html"),
-                    "-sourcepath", srcdir,
-                    "p1", "p2"
-                });
-        runTestsOnHTML(testArray);
+                    "-overview", testSrc("overview.html"),
+                    "-sourcepath", testSrc,
+                    "p1", "p2");
+        checkExit(Exit.OK);
 
-        printSummary();
+        // Test the proper DOCTYPE element are present:
+        checkOutput("index.html",              true, FRAMESET);
+        checkOutput("overview-summary.html",   true, LOOSE);
+        checkOutput("p1/package-summary.html", true, LOOSE);
+        checkOutput("p1/C.html",               true, LOOSE);
+        checkOutput("overview-frame.html",     true, LOOSE);
+        checkOutput("allclasses-frame.html",   true, LOOSE);
+        checkOutput("p1/package-frame.html",   true, LOOSE);
+
+        // Test that <NOFRAMES> is inside <FRAMESET> element:
+        checkOutput("index.html", true,
+                "</noframes>\n"
+                + "</frameset>");
+
+        // Test the table elements are in the correct order:
+        checkOutput("p1/package-use.html", true,
+                "</td>\n"
+                + "</tr>");
     }
 
-    /** Run javadoc */
-    public static void runJavadoc(String[] javadocArgs) {
-        if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) {
-            throw new Error("Javadoc failed to execute");
-        }
-    }
-
-    /**
-     * 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 proper DOCTYPE element is present:
-        {
-            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">",
-            TMPDEST_DIR1 + "index.html"
-        },
-        // Test the proper DOCTYPE element is present:
-        {
-            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
-            TMPDEST_DIR1 + "overview-summary.html"
-        },
-        // Test the proper DOCTYPE element is present:
-        {
-            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
-            TMPDEST_DIR1 + "p1/package-summary.html"
-        },
-        // Test the proper DOCTYPE element is present:
-        {
-            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
-            TMPDEST_DIR1 + "p1/C.html"
-        },
-        // Test the proper DOCTYPE element is present:
-        {
-            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
-            TMPDEST_DIR1 + "overview-frame.html"
-        },
-        // Test the proper DOCTYPE element is present:
-        {
-            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
-            TMPDEST_DIR1 + "allclasses-frame.html"
-        },
-        // Test the proper DOCTYPE element is present:
-        {
-            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">",
-            TMPDEST_DIR1 + "p1/package-frame.html"
-        },
-        // Test that <NOFRAMES> is inside <FRAMESET> element:
-        {
-            "</noframes>\n" +
-            "</frameset>",
-            TMPDEST_DIR1 + "index.html"
-        },
-        // Test the table elements are in the correct order:
-        {
-            "</td>\n" +
-            "</tr>",
-            TMPDEST_DIR1 + "/p1/package-use.html"
-        }
-    };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum) + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n" + "when searching for:\n" + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if (numSubtestsPassed == subtestNum) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum) + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if (!file.exists()) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int) file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int) file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.replace(NL, "\n").indexOf(stringToFind);
-    }
+    private static final String FRAMESET =
+            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\" \"http://www.w3.org/TR/html4/frameset.dtd\">";
+    private static final String LOOSE =
+            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
 }
--- a/test/com/sun/javadoc/VersionNumber/VersionNumber.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/VersionNumber/VersionNumber.java	Fri May 09 15:37:12 2014 -0700
@@ -26,131 +26,31 @@
  * @bug 4720849
  * @summary  com.sun.tools.doclets.standard.Standard contains hard-coded version number
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main VersionNumber
  */
 
 
-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 VersionNumber {
+public class VersionNumber extends JavadocTester {
 
-    private static final String BUGID = "4720849";
-    private static final String BUGNAME = "VersionNumber";
-    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,
-                                 "p1"});
-        runTestsOnHTML(testArray);
-
-        printSummary();
+    public static void main(String... args) throws Exception {
+        VersionNumber tester = new VersionNumber();
+        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",
+                "p1");
+        checkExit(Exit.OK);
+
+        // Test the proper DOCTYPE element is present:
+        checkOutput("p1/C.html", true,
+                "<!-- Generated by javadoc (");
     }
 
-    /**
-     * 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 proper DOCTYPE element is present:
-            {
-                 "<!-- Generated by javadoc (",
-                     TMPDEST_DIR1 + "p1/C.html"  },
-
-        };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
-    }
-
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
-    }
-
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.indexOf(stringToFind);
-    }
 }
--- a/test/com/sun/javadoc/WindowTitles/WindowTitles.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/WindowTitles/WindowTitles.java	Fri May 09 15:37:12 2014 -0700
@@ -26,193 +26,62 @@
  * @bug 4530730
  * @summary stddoclet: With frames off, window titles have "()" appended
  * @author dkramer
+ * @library ../lib
+ * @build JavadocTester
  * @run main WindowTitles
  */
 
-
-import com.sun.javadoc.*;
-import java.util.*;
-import java.io.*;
-
-// If needing regular expression pattern matching,
-// see /java/pubs/dev/linkfix/src/LinkFix.java
-
 /**
  * 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 WindowTitles
-{
-    private static final String BUGID = "4530730";
-    private static final String BUGNAME = "WindowTitles";
-    private static final String TMPDIR_STRING1 = "./docs1/";
-    private static final String TMPDIR_STRING2 = "./docs2/";
+public class WindowTitles extends JavadocTester {
 
-    // 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", TMPDIR_STRING1,
-                                 "-use",
-                                 "-sourcepath", srcdir,
-                                 "p1", "p2"});
-        runTestsOnHTML(testArray);
-
-        // Test only for the split-index case (and run on only one package)
-        System.out.println("");  // blank line
-        runJavadoc(new String[] {"-d", TMPDIR_STRING2,
-                                 "-splitindex",
-                                 "-sourcepath", System.getProperty("test.src", "."),
-                                 "p1"});
-        runTestsOnHTML(testSplitIndexArray);
-
-        printSummary();
+    public static void main(String... args) throws Exception {
+        WindowTitles tester = new WindowTitles();
+        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() {
+        // Test for all cases except the split index page
+        javadoc("-d", "out-1",
+                "-use",
+                "-sourcepath", testSrc,
+                "p1", "p2");
+        checkExit(Exit.OK);
+
+        checkTitle("overview-summary.html",     "Overview");
+        checkTitle("overview-tree.html",        "Class Hierarchy");
+        checkTitle("overview-frame.html",       "Overview List");
+        checkTitle("p1/package-summary.html",   "p1");
+        checkTitle("p1/package-frame.html",     "p1");
+        checkTitle("p1/package-tree.html",      "p1 Class Hierarchy");
+        checkTitle("p1/package-use.html",       "Uses of Package p1");
+        checkTitle("p1/C1.html",                "C1");
+        checkTitle("allclasses-frame.html",     "All Classes");
+        checkTitle("allclasses-noframe.html",   "All Classes");
+        checkTitle("constant-values.html",      "Constant Field Values");
+        checkTitle("deprecated-list.html",      "Deprecated List");
+        checkTitle("serialized-form.html",      "Serialized Form");
+        checkTitle("help-doc.html",             "API Help");
+        checkTitle("index-all.html",            "Index");
+        checkTitle("p1/class-use/C1.html",      "Uses of Class p1.C1");
     }
 
-    /**
-     * Assign value for [ stringToFind, filename ]
-     * NOTE: The standard doclet uses platform-specific line separators ("\n")
-     */
-    private static final String[][] testArray = {
+    @Test
+    void test2() {
+        // Test only for the split-index case (and run on only one package)
+        javadoc("-d", "out-2",
+                "-splitindex",
+                "-sourcepath", testSrc,
+                "p1");
+        checkExit(Exit.OK);
 
-            { "<title>Overview</title>",
-                    TMPDIR_STRING1 + "overview-summary.html"                  },
-
-            { "<title>Class Hierarchy</title>",
-                    TMPDIR_STRING1 + "overview-tree.html"                     },
-
-            { "<title>Overview List</title>",
-                    TMPDIR_STRING1 + "overview-frame.html"                    },
-
-            { "<title>p1</title>",
-                    TMPDIR_STRING1 + "p1/package-summary.html"       },
-
-            { "<title>p1</title>",
-                    TMPDIR_STRING1 + "p1/package-frame.html"         },
-
-            { "<title>p1 Class Hierarchy</title>",
-                    TMPDIR_STRING1 + "p1/package-tree.html"          },
-
-            { "<title>Uses of Package p1</title>",
-                    TMPDIR_STRING1 + "p1/package-use.html"           },
-
-            { "<title>C1</title>",
-                    TMPDIR_STRING1 + "p1/C1.html"                    },
-
-            { "<title>All Classes</title>",
-                    TMPDIR_STRING1 + "allclasses-frame.html"                  },
-
-            { "<title>All Classes</title>",
-                    TMPDIR_STRING1 + "allclasses-noframe.html"                },
-
-            { "<title>Constant Field Values</title>",
-                    TMPDIR_STRING1 + "constant-values.html"                   },
-
-            { "<title>Deprecated List</title>",
-                    TMPDIR_STRING1 + "deprecated-list.html"                   },
-
-            { "<title>Serialized Form</title>",
-                    TMPDIR_STRING1 + "serialized-form.html"                   },
-
-            { "<title>API Help</title>",
-                    TMPDIR_STRING1 + "help-doc.html"                          },
-
-            { "<title>Index</title>",
-                    TMPDIR_STRING1 + "index-all.html"                         },
-
-            { "<title>Uses of Class p1.C1</title>",
-                    TMPDIR_STRING1 + "p1/class-use/C1.html" },
-        };
-
-    /**
-     * Assign value for [ stringToFind, filename ] for split index page
-     */
-    private static final String[][] testSplitIndexArray = {
-            { "<title>C-Index</title>",
-                    TMPDIR_STRING2 + "index-files/index-1.html"       },
-        };
-
-    public static void runTestsOnHTML(String[][] testArray) {
-
-        for (int i = 0; i < testArray.length; i++) {
-
-            subtestNum += 1;
-
-            // Read contents of file into a string
-            String fileString = readFileToString(testArray[i][1]);
-
-            // Get string to find
-            String stringToFind = testArray[i][0];
-
-            // Find string in file's contents
-            if (findString(fileString, stringToFind) == -1) {
-                System.out.println("\nSub-test " + (subtestNum)
-                    + " for bug " + BUGID + " (" + BUGNAME + ") FAILED\n"
-                    + "when searching for:\n"
-                    + stringToFind);
-            } else {
-                numSubtestsPassed += 1;
-                System.out.println("\nSub-test " + (subtestNum) + " passed:\n" + stringToFind);
-            }
-        }
+        checkTitle("index-files/index-1.html", "C-Index");
     }
 
-    public static void printSummary() {
-        if ( numSubtestsPassed == subtestNum ) {
-            System.out.println("\nAll " + numSubtestsPassed + " subtests passed");
-        } else {
-            throw new Error("\n" + (subtestNum - numSubtestsPassed) + " of " + (subtestNum)
-                             + " subtests failed for bug " + BUGID + " (" + BUGNAME + ")\n");
-        }
+    void checkTitle(String file, String title) {
+        checkOutput(file, true, "<title>" + title + "</title>");
     }
 
-    // Read the file into a String
-    public static String readFileToString(String filename) {
-        try {
-            File file = new File(filename);
-            if ( !file.exists() ) {
-                System.out.println("\nFILE DOES NOT EXIST: " + filename);
-            }
-            BufferedReader in = new BufferedReader(new FileReader(file));
-
-            // Create an array of characters the size of the file
-            char[] allChars = new char[(int)file.length()];
-
-            // Read the characters into the allChars array
-            in.read(allChars, 0, (int)file.length());
-            in.close();
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-
-            return allCharsString;
-
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            return "";
-        } catch (IOException e) {
-            System.err.println(e);
-            return "";
-        }
-    }
-
-    public static int findString(String fileString, String stringToFind) {
-        return fileString.indexOf(stringToFind);
-    }
 }
--- a/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/constantValues/TestConstantValuesDriver.java	Fri May 09 15:37:12 2014 -0700
@@ -26,42 +26,30 @@
  * @bug 4504730 4526070 5077317
  * @summary Test the generation of constant-values.html.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestConstantValuesDriver
  * @run main TestConstantValuesDriver
  */
 public class TestConstantValuesDriver extends JavadocTester {
 
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, SRC_DIR + "/TestConstantValues.java",
-        SRC_DIR + "/TestConstantValues2.java",
-        SRC_DIR + "/A.java"
-    };
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        String[][] tests = new String[5][2];
-        for (int i = 0; i < tests.length-1; i++) {
-            tests[i][0] = "constant-values.html";
-            tests[i][1] = "TEST"+(i+1)+"PASSES";
-        }
-        tests[tests.length-1][0] = "constant-values.html";
-        tests[tests.length-1][1] = "<code>\"&lt;Hello World&gt;\"</code>";
+    public static void main(String... args) throws Exception {
         TestConstantValuesDriver tester = new TestConstantValuesDriver();
-        tester.run(ARGS, tests, NO_TEST);
-        tester.printSummary();
+        tester.runTests();
     }
 
-    /**
-     * @throws java.io.IOException Test 1 passes
-     * @throws java.io.IOException Test 2 passes
-     * @throws java.lang.NullPointerException comment three
-     * @throws java.io.IOException Test 3 passes
-     */
-    public void method(){}
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                testSrc("TestConstantValues.java"),
+                testSrc("TestConstantValues2.java"),
+                testSrc("A.java"));
+        checkExit(Exit.OK);
 
+        checkOutput("constant-values.html", true,
+                "TEST1PASSES",
+                "TEST2PASSES",
+                "TEST3PASSES",
+                "TEST4PASSES",
+                "<code>\"&lt;Hello World&gt;\"</code>");
+    }
 }
--- a/test/com/sun/javadoc/dupThrowsTags/TestDupThrowsTags.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/dupThrowsTags/TestDupThrowsTags.java	Fri May 09 15:37:12 2014 -0700
@@ -26,30 +26,28 @@
  * @bug 4525364
  * @summary Determine if duplicate throws tags can be used.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestDupThrowsTags
  * @run main TestDupThrowsTags
  */
 public class TestDupThrowsTags extends JavadocTester {
 
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, SRC_DIR + "/TestDupThrowsTags.java"
-    };
+    public static void main(String... args) throws Exception {
+        TestDupThrowsTags tester = new TestDupThrowsTags();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        String[][] tests = new String[4][2];
-        for (int i = 0; i < tests.length; i++) {
-            tests[i][0] = "TestDupThrowsTags.html";
-            tests[i][1] = "Test "+(i+1)+" passes";
-        }
-        TestDupThrowsTags tester = new TestDupThrowsTags();
-        tester.run(ARGS, tests, NO_TEST);
-        tester.printSummary();
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                testSrc("TestDupThrowsTags.java"));
+        checkExit(Exit.FAILED);
+
+        checkOutput("TestDupThrowsTags.html", true,
+                "Test 1 passes",
+                "Test 2 passes",
+                "Test 3 passes",
+                "Test 4 passes");
     }
 
     /**
@@ -58,6 +56,6 @@
      * @throws java.lang.NullPointerException Test 3 passes
      * @throws java.io.IOException Test 4 passes
      */
-    public void method(){}
+    public void method() {}
 
 }
--- a/test/com/sun/javadoc/lib/JavadocTester.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/lib/JavadocTester.java	Fri May 09 15:37:12 2014 -0700
@@ -21,102 +21,163 @@
  * questions.
  */
 
-import java.io.*;
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.ref.SoftReference;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
- * Runs javadoc and then runs regression tests on the resulting output.
- * This class currently contains three tests:
- * <ul>
- * <li> String search: Reads each file, complete with newlines,
- *      into a string.  Lets you search for strings that contain
- *      newlines.  String matching is case-sensitive.
- *      You can run javadoc multiple times with different arguments,
- *      generating output into different destination directories, and
- *      then perform a different array of tests on each one.
- *      To do this, the run method accepts a test array for testing
- *      that a string is found, and a negated test array for testing
- *      that a string is not found.
- * <li> Run diffs: Iterate through the list of given file pairs
- *      and diff the pairs.
- * <li> Check exit code: Check the exit code of Javadoc and
- *      record whether the test passed or failed.
- * </ul>
+ * Test framework for running javadoc and performing tests on the resulting output.
+ *
+ * <p>
+ * Tests are typically written as subtypes of JavadocTester, with a main
+ * method that creates an instance of the test class and calls the runTests()
+ * method. The runTests() methods calls all the test methods declared in the class,
+ * and then calls a method to print a summary, and throw an exception if
+ * any of the test methods reported a failure.
+ *
+ * <p>
+ * Test methods are identified with a @Test annotation. They have no parameters.
+ * The name of the method is not important, but if you have more than one, it is
+ * recommended that the names be meaningful and suggestive of the test case
+ * contained therein.
+ *
+ * <p>
+ * Typically, a test method will invoke javadoc, and then perform various
+ * checks on the results. The standard checks are:
+ *
+ * <dl>
+ * <dt>checkExitCode
+ * <dd>Check the exit code returned from javadoc.
+ * <dt>checkOutput
+ * <dd>Perform a series of checks on the contents on a file or output stream
+ *     generated by javadoc.
+ *     The checks can be either that a series of strings are found or are not found.
+ * <dt>checkFiles
+ * <dd>Perform a series of checks on the files generated by javadoc.
+ *     The checks can be that a series of files are found or are not found.
+ * </dl>
+ *
+ * <pre><code>
+ *  public class MyTester extends JavadocTester {
+ *      public static void main(String... args) throws Exception {
+ *          MyTester tester = new MyTester();
+ *          tester.runTests();
+ *      }
+ *
+ *      // test methods...
+ *      @Test
+ *      void test() {
+ *          javadoc(<i>args</i>);
+ *          checkExit(Exit.OK);
+ *          checkOutput(<i>file</i>, true,
+ *              <i>strings-to-find</i>);
+ *          checkOutput(<i>file</i>, false,
+ *              <i>strings-to-not-find</i>);
+ *      }
+ *  }
+ * </code></pre>
+ *
+ * <p>
+ * If javadoc is run more than once in a test method, you can compare the
+ * results that are generated with the diff method. Since files written by
+ * javadoc typically contain a timestamp, you may want to use the -notimestamp
+ * option if you are going to compare the results from two runs of javadoc.
+ *
+ * <p>
+ * If you have many calls of checkOutput that are very similar, you can write
+ * your own check... method to reduce the amount of duplication. For example,
+ * if you want to check that many files contain the same string, you could
+ * write a method that takes a varargs list of files and calls checkOutput
+ * on each file in turn with the string to be checked.
+ *
+ * <p>
+ * You can also write you own custom check methods, which can use
+ * readFile to get the contents of a file generated by javadoc,
+ * and then use pass(...) or fail(...) to report whether the check
+ * succeeded or not.
+ *
+ * <p>
+ * You can have many separate test methods, each identified with a @Test
+ * annotation. However, you should <b>not</b> assume they will be called
+ * in the order declared in your source file.  If the order of a series
+ * of javadoc invocations is important, do that within a single method.
+ * If the invocations are independent, for better clarity, use separate
+ * test methods, each with their own set of checks on the results.
  *
  * @author Doug Kramer
  * @author Jamie Ho
- * @since 1.4.2
+ * @author Jonathan Gibbons (rewrite)
  */
 public abstract class JavadocTester {
 
-    protected static final String NL = System.getProperty("line.separator");
-    protected static final String FS = System.getProperty("file.separator");
+    public static final String FS = System.getProperty("file.separator");
+    public static final String PS = System.getProperty("path.separator");
+    public static final String NL = System.getProperty("line.separator");
 
-    protected static final String SRC_DIR = System.getProperty("test.src", ".");
-    protected static final String JAVA_VERSION = System.getProperty("java.version");
-    protected static final String OUTPUT_DIR = "out";
-    protected static final String[][] NO_TEST = new String[][] {};
-    protected static final String[] NO_FILE_TEST = new String[] {};
+    public enum Output {
+        /** The name for error output from javadoc. */
+        ERROR,
+        /** The name for the notice output from javadoc. */
+        NOTICE,
+        /** The name for the warning output  from javadoc. */
+        WARNING,
+        /** The name for any output written to System.out. */
+        STDOUT,
+        /** The name for any output written to System.err. */
+        STDERR
+    }
+
+    /** The output directory used in the most recent call of javadoc. */
+    protected File outputDir;
+
+    /** The exit code of the most recent call of javadoc. */
+    private int exitCode;
+
+    /** The output generated by javadoc to the various writers and streams. */
+    private final Map<Output, String> outputMap = new EnumMap<>(Output.class);
+
+    /** A cache of file content, to avoid reading files unnecessarily. */
+    private final Map<File,SoftReference<String>> fileContentCache = new HashMap<>();
+
+    /** Stream used for logging messages. */
+    private final PrintStream out = System.out;
+
+    /** The directory containing the source code for the test. */
+    public static final String testSrc = System.getProperty("test.src");
 
     /**
-     * Use this as the file name in the test array when you want to search
-     * for a string in the error output.
+     * Get the path for a source file in the test source directory.
+     * @param path the path of a file or directory in the source directory
+     * @return the full path of the specified file
      */
-    public static final String ERROR_OUTPUT = "ERROR_OUTPUT";
-
-    /**
-     * Use this as the file name in the test array when you want to search
-     * for a string in the notice output.
-     */
-    public static final String NOTICE_OUTPUT = "NOTICE_OUTPUT";
-
-    /**
-     * Use this as the file name in the test array when you want to search
-     * for a string in the warning output.
-     */
-    public static final String WARNING_OUTPUT = "WARNING_OUTPUT";
-
-    /**
-     * Use this as the file name in the test array when you want to search
-     * for a string in standard output.
-     */
-    public static final String STANDARD_OUTPUT = "STANDARD_OUTPUT";
-
-    /**
-     * The default doclet.
-     */
-    public static final String DEFAULT_DOCLET_CLASS = "com.sun.tools.doclets.formats.html.HtmlDoclet";
-    public static final String DEFAULT_DOCLET_CLASS_OLD = "com.sun.tools.doclets.standard.Standard";
-
-    /**
-     * The writer to write error messages.
-     */
-    public StringWriter errors;
-
-    /**
-     * The writer to write notices.
-     */
-    public StringWriter notices;
-
-    /**
-     * The writer to write warnings.
-     */
-    public StringWriter warnings;
-
-    /**
-     * The buffer of warning output.
-     */
-    public StringBuffer standardOut;
-
-    /**
-     * The output directory.
-     */
-    private File outputDir;
+    public static String testSrc(String path) {
+        return new File(testSrc, path).getPath();
+    }
 
     /**
      * Alternatives for checking the contents of a directory.
      */
-    enum DirectoryCheck {
+    public enum DirectoryCheck {
         /**
          * Check that the directory is empty.
          */
@@ -153,91 +214,75 @@
 
     private DirectoryCheck outputDirectoryCheck = DirectoryCheck.EMPTY;
 
-    /**
-     * The current subtest number.
-     */
-    private static int numTestsRun = 0;
+    /** The current subtest number. Incremented when checking(...) is called. */
+    private int numTestsRun = 0;
+
+    /** The number of subtests passed. Incremented when passed(...) is called. */
+    private int numTestsPassed = 0;
+
+    /** The current run of javadoc. Incremented when javadoc is called. */
+    private int javadocRunNum = 0;
+
+    /** The name of the standard doclet. */
+    // This ought not to be necessary; there ought to be a javadoc entry point
+    // that does not require this to be know externally.
+    private static final String standardDocletClassName =
+            "com.sun.tools.doclets.standard.Standard";
+
+    /** Marker annotation for test methods to be invoked by runTests. */
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Test { }
 
     /**
-     * The number of subtests passed.
+     * Run all methods annotated with @Test, followed by printSummary.
+     * Typically called on a tester object in main()
+     * @throws Exception if any errors occurred
      */
-    private static int numTestsPassed = 0;
-
-    /**
-     * The current run of javadoc
-     */
-    private static int javadocRunNum = 0;
-
-    /**
-     * Construct a JavadocTester.
-     */
-    public JavadocTester() {
+    public void runTests() throws Exception {
+        for (Method m: getClass().getDeclaredMethods()) {
+            Annotation a = m.getAnnotation(Test.class);
+            if (a != null) {
+                try {
+                    out.println("Running test " + m.getName());
+                    m.invoke(this, new Object[] { });
+                } catch (InvocationTargetException e) {
+                    Throwable cause = e.getCause();
+                    throw (cause instanceof Exception) ? ((Exception) cause) : e;
+                }
+                out.println();
+            }
+        }
+        printSummary();
     }
 
     /**
-     * Execute the tests.
+     * Run javadoc.
+     * The output directory used by this call and the final exit code
+     * will be saved for later use.
+     * To aid the reader, it is recommended that calls to this method
+     * put each option and the arguments it takes on a separate line.
      *
-     * @param args             the arguments to pass to Javadoc
-     * @param testArray        the array of tests
-     * @param negatedTestArray the array of negated tests
-     * @return                 the return code for the execution of Javadoc
+     * Example:
+     * <pre><code>
+     *  javadoc("-d", "out",
+     *          "-sourcepath", testSrc,
+     *          "-notimestamp",
+     *          "pkg1", "pkg2", "pkg3/C.java");
+     * </code></pre>
+     *
+     * @param args the arguments to pass to javadoc
      */
-    public int run(String[] args,
-            String[][] testArray, String[][] negatedTestArray) {
-        int returnCode = runJavadoc(args);
-        runTestsOnHTML(testArray, negatedTestArray);
-        return returnCode;
-    }
+    public void javadoc(String... args) {
+        outputMap.clear();
+        fileContentCache.clear();
 
-    /**
-     * Execute the tests.
-     *
-     * @param args                 the arguments to pass to Javadoc
-     * @param testArray            the array of tests
-     * @param negatedTestArray     the array of negated tests
-     * @param fileTestArray        the array of file tests
-     * @param negatedFileTestArray the array of negated file tests
-     * @return                     the return code for the execution of Javadoc
-     */
-    public int run(String[] args,
-            String[][] testArray, String[][] negatedTestArray,
-            String[] fileTestArray, String[] negatedFileTestArray) {
-        int returnCode = runJavadoc(args);
-        runTestsOnHTML(testArray, negatedTestArray);
-        runTestsOnFile(fileTestArray, negatedFileTestArray);
-        return returnCode;
-    }
-
-    /**
-     * Execute Javadoc using the default doclet.
-     *
-     * @param args  the arguments to pass to Javadoc
-     * @return      the return code from the execution of Javadoc
-     */
-    public int runJavadoc(String[] args) {
-        float javaVersion = Float.parseFloat(JAVA_VERSION.substring(0,3));
-        String docletClass = javaVersion < 1.5 ?
-            DEFAULT_DOCLET_CLASS_OLD : DEFAULT_DOCLET_CLASS;
-        return runJavadoc(docletClass, args);
-    }
-
-
-    /**
-     * Execute Javadoc.
-     *
-     * @param docletClass the doclet being tested.
-     * @param args  the arguments to pass to Javadoc
-     * @return      the return code from the execution of Javadoc
-     */
-    public int runJavadoc(String docletClass, String[] args) {
         javadocRunNum++;
         if (javadocRunNum == 1) {
-            System.out.println("\n" + "Running javadoc...");
+            out.println("Running javadoc...");
         } else {
-            System.out.println("\n" + "Running javadoc (run "
+            out.println("Running javadoc (run "
                                     + javadocRunNum + ")...");
         }
-        initOutputBuffers();
         outputDir = new File(".");
         for (int i = 0; i < args.length - 2; i++) {
             if (args[i].equals("-d")) {
@@ -245,363 +290,199 @@
                 break;
             }
         }
+//        log.setOutDir(outputDir);
 
         outputDirectoryCheck.check(outputDir);
 
-        ByteArrayOutputStream stdout = new ByteArrayOutputStream();
-        PrintStream prevOut = System.out;
-        System.setOut(new PrintStream(stdout));
+        // These are the primary streams used by javadoc
+        WriterOutput errOut = new WriterOutput();
+        WriterOutput warnOut = new WriterOutput();
+        WriterOutput noticeOut = new WriterOutput();
+        // These are to catch output to System.out and System.err,
+        // in case these are used instead of the primary streams
+        StreamOutput sysOut = new StreamOutput(System.out, System::setOut);
+        StreamOutput sysErr = new StreamOutput(System.err, System::setErr);
 
-        ByteArrayOutputStream stderr = new ByteArrayOutputStream();
-        PrintStream prevErr = System.err;
-        System.setErr(new PrintStream(stderr));
+        try {
+            exitCode = com.sun.tools.javadoc.Main.execute(
+                    "javadoc",
+                    errOut.pw, warnOut.pw, noticeOut.pw,
+                    standardDocletClassName,
+                    args);
+        } finally {
+            outputMap.put(Output.STDOUT, sysOut.close());
+            outputMap.put(Output.STDERR, sysErr.close());
+            outputMap.put(Output.ERROR, errOut.close());
+            outputMap.put(Output.WARNING, warnOut.close());
+            outputMap.put(Output.NOTICE, noticeOut.close());
+        }
 
-        int returnCode = com.sun.tools.javadoc.Main.execute(
-                "javadoc",
-                new PrintWriter(errors, true),
-                new PrintWriter(warnings, true),
-                new PrintWriter(notices, true),
-                docletClass,
-                getClass().getClassLoader(),
-                args);
-        System.setOut(prevOut);
-        standardOut = new StringBuffer(stdout.toString());
-        System.setErr(prevErr);
-        errors.write(NL + stderr.toString());
-
-        printJavadocOutput();
-        return returnCode;
+        outputMap.forEach((name, text) -> {
+            if (!text.isEmpty()) {
+                out.println("javadoc " + name + ":");
+                out.println(text);
+            }
+        });
     }
 
     /**
-     * Set a filter to check the initial contents of the output directory
+     * Set the kind of check for the initial contents of the output directory
      * before javadoc is run.
      * The filter should return true for files that should <b>not</b> appear.
+     * @param c the kind of check to perform
      */
-    public void setCheckOutputDirectoryCheck(DirectoryCheck c) {
+    public void setOutputDirectoryCheck(DirectoryCheck c) {
         outputDirectoryCheck = c;
     }
 
-    /**
-     * Create new string writer buffers
-     */
-    private void initOutputBuffers() {
-        errors   = new StringWriter();
-        notices  = new StringWriter();
-        warnings = new StringWriter();
+    public enum Exit {
+        OK(0),
+        FAILED(1);
+
+        Exit(int code) {
+            this.code = code;
+        }
+
+        final int code;
     }
 
     /**
-     * Run array of tests on the resulting HTML.
-     * This method accepts a testArray for testing that a string is found
-     * and a negatedTestArray for testing that a string is not found.
+     * Check the exit code of the most recent call of javadoc.
      *
-     * @param testArray         the array of tests
-     * @param negatedTestArray  the array of negated tests
+     * @param expected the exit code that is required for the test
+     * to pass.
      */
-    public void runTestsOnHTML(String[][] testArray, String[][] negatedTestArray) {
-        runTestsOnHTML(testArray, false);
-        runTestsOnHTML(negatedTestArray, true);
+    public void checkExit(Exit expected) {
+        checking("check exit code");
+        if (exitCode == expected.code) {
+            passed("return code " + exitCode);
+        } else {
+            failed("return code " + exitCode +"; expected " + expected.code + " (" + expected + ")");
+        }
     }
 
     /**
-     * Run array of tests on the generated files.
-     * This method accepts a fileTestArray for testing if a file is generated
-     * and a negatedFileTestArray for testing if a file is not found.
-     * The files are relative to the most recent output directory specified
-     * with -d.
-     *
-     * @param fileTestArray         the array of file tests
-     * @param negatedFileTestArray  the array of negated file tests
+     * Check for content in (or not in) the generated output.
+     * Within the search strings, the newline character \n
+     * will be translated to the platform newline character sequence.
+     * @param path a path within the most recent output directory
+     *  or the name of one of the output buffers, identifying
+     *  where to look for the search strings.
+     * @param expectedFound true if all of the search strings are expected
+     *  to be found, or false if all of the strings are expected to be
+     *  not found
+     * @param strings the strings to be searched for
      */
-    public void runTestsOnFile(String[] fileTestArray, String[] negatedFileTestArray) {
-        runTestsOnFile(outputDir, fileTestArray, false);
-        runTestsOnFile(outputDir, negatedFileTestArray, true);
+    public void checkOutput(String path, boolean expectedFound, String... strings) {
+        // Read contents of file
+        String fileString;
+        try {
+            fileString = readFile(outputDir, path);
+        } catch (Error e) {
+            if (!expectedFound) {
+                failed("Error reading file: " + e);
+                return;
+            }
+            throw e;
+        }
+        checkOutput(path, fileString, expectedFound, strings);
     }
 
     /**
-     * Run the array of tests on the resulting HTML.
-     * The files are relative to the most recent output directory specified
-     * with -d.
-     *
-     * @param testArray the array of tests
-     * @param isNegated true if test is negated; false otherwise
+     * Check for content in (or not in) the one of the output streams written by
+     * javadoc. Within the search strings, the newline character \n
+     * will be translated to the platform newline character sequence.
+     * @param output the output stream to check
+     * @param expectedFound true if all of the search strings are expected
+     *  to be found, or false if all of the strings are expected to be
+     *  not found
+     * @param strings the strings to be searched for
      */
-    private void runTestsOnHTML(String[][] testArray , boolean isNegated) {
-        for (String[] test : testArray) {
-            numTestsRun++;
-            System.out.print("Running subtest #" + numTestsRun + "... ");
-            // Get string to find
-            String stringToFind = test[1];
-            // Read contents of file into a string
-            String fileString;
-            try {
-                fileString = readFileToString(outputDir, test[0]);
-            } catch (Error e) {
-                if (isNegated) {
-                    System.out.println( "FAILED, due to " + e + "\n");
-                    continue;
-                }
-                throw e;
-            }
+    public void checkOutput(Output output, boolean expectedFound, String... strings) {
+        checkOutput(output.toString(), outputMap.get(output), expectedFound, strings);
+    }
+
+    private void checkOutput(String path, String fileString, boolean expectedFound, String... strings) {
+        for (String stringToFind : strings) {
+//            log.logCheckOutput(path, expectedFound, stringToFind);
+            checking("checkOutput");
             // Find string in file's contents
             boolean isFound = findString(fileString, stringToFind);
-            if ((isNegated && !isFound) || (!isNegated && isFound)) {
-                numTestsPassed += 1;
-                System.out.println("Passed" + "\n"
-                        + (isNegated ? "not found:" : "found:") + "\n"
-                        + stringToFind + " in " + test[0] + "\n");
+            if (isFound == expectedFound) {
+                passed(path + ": " + (isFound ? "found:" : "not found:") + "\n"
+                        + stringToFind + "\n");
             } else {
-                System.out.println("FAILED, when searching for:" + "\n"
-                        + stringToFind
-                        + " in " + test[0] + "\n");
+                failed(path + ": " + (isFound ? "found:" : "not found:") + "\n"
+                        + stringToFind + "\n");
             }
         }
     }
 
     /**
-     * Run the array of file tests on the generated files.
-     *
-     * @param testArray the array of file tests
-     * @param isNegated true if test is negated; false otherwise
-     */
-    private void runTestsOnFile(File baseDir, String[] testArray, boolean isNegated) {
-        for (String fileName : testArray) {
-            numTestsRun++;
-            String failedString = "FAILED: file (" + fileName + ") found" + "\n";
-            String passedString = "Passed" + "\n" +
-                    "file (" + fileName + ") not found" + "\n";
-            System.out.print("Running subtest #" + numTestsRun + "... ");
-            try {
-                File file = new File(baseDir, fileName);
-                if ((file.exists() && !isNegated) || (!file.exists() && isNegated)) {
-                    numTestsPassed += 1;
-                    System.out.println(passedString);
-                } else {
-                    System.out.println(failedString);
-                }
-            } catch (Error e) {
-                System.err.println(e);
+     * Check for files in (or not in) the generated output.
+     * @param expectedFound true if all of the files are expected
+     *  to be found, or false if all of the files are expected to be
+     *  not found
+     * @param paths the files to check, within the most recent output directory.
+     * */
+    public void checkFiles(boolean expectedFound, String... paths) {
+        for (String path: paths) {
+//            log.logCheckFile(path, expectedFound);
+            checking("checkFile");
+            File file = new File(outputDir, path);
+            boolean isFound = file.exists();
+            if (isFound == expectedFound) {
+                passed(path + ": " + (isFound ? "found:" : "not found:") + "\n");
+            } else {
+                failed(path + ": " + (isFound ? "found:" : "not found:") + "\n");
             }
         }
     }
 
     /**
-     * Iterate through the list of given file pairs and diff each file.
+     * Check that a series of strings are found in order in a file in
+     * the generated output.
+     * @param path the file to check
+     * @param strings  the strings whose order to check
+     */
+    public void checkOrder(String path, String... strings) {
+        String fileString = readOutputFile(path);
+        int prevIndex = -1;
+        for (String s : strings) {
+            int currentIndex = fileString.indexOf(s);
+            checking(s + " at index " + currentIndex);
+            if (currentIndex >= prevIndex) {
+                passed(s + "is in the correct order");
+            } else {
+                failed(s + " is in the wrong order.");
+            }
+            prevIndex = currentIndex;
+        }
+    }
+
+    /**
+     * Compare a set of files in each of two directories.
      *
      * @param baseDir1 the directory containing the first set of files
      * @param baseDir2 the directory containing the second set of files
      * @param files the set of files to be compared
-     * @throws Error if any differences are found between
-     * file pairs.
      */
-    public void runDiffs(String baseDir1, String baseDir2, String[] files) throws Error {
-        runDiffs(baseDir1, baseDir2, files, true);
-    }
-
-    /**
-     * Iterate through the list of given file pairs and diff each file.
-     *
-     * @param baseDir1 the directory containing the first set of files
-     * @param baseDir2 the directory containing the second set of files
-     * @param files the set of files to be compared
-     * @param throwErrorIfNoMatch flag to indicate whether or not to throw
-     * an error if the files do not match.
-     *
-     * @throws Error if any differences are found between
-     * file pairs and throwErrorIfNoMatch is true.
-     */
-    public void runDiffs(String baseDir1, String baseDir2, String[] files, boolean throwErrorIfNoMatch) throws Error {
+    public void diff(String baseDir1, String baseDir2, String... files) {
         File bd1 = new File(baseDir1);
         File bd2 = new File(baseDir2);
         for (String file : files) {
-            diff(bd1, bd2, file, throwErrorIfNoMatch);
+            diff(bd1, bd2, file);
         }
     }
 
     /**
-     * Check the exit code of Javadoc and record whether the test passed
-     * or failed.
-     *
-     * @param expectedExitCode The exit code that is required for the test
-     * to pass.
-     * @param actualExitCode The actual exit code from the previous run of
-     * Javadoc.
-     */
-    public void checkExitCode(int expectedExitCode, int actualExitCode) {
-        numTestsRun++;
-        if (expectedExitCode == actualExitCode) {
-            System.out.println( "Passed" + "\n" + " got return code " +
-                actualExitCode);
-            numTestsPassed++;
-        } else {
-            System.out.println( "FAILED: expected return code " +
-                expectedExitCode + " but got " + actualExitCode);
-        }
-    }
-
-    /**
-     * Print a summary of the test results.
-     */
-    protected void printSummary() {
-        if ( numTestsRun != 0 && numTestsPassed == numTestsRun ) {
-            // Test passed
-            System.out.println("\n" + "All " + numTestsPassed
-                                             + " subtests passed");
-        } else {
-            // Test failed
-            throw new Error("\n" + (numTestsRun - numTestsPassed)
-                                    + " of " + (numTestsRun)
-                                    + " subtests failed\n");
-        }
-    }
-
-    /**
-     * Print the output stored in the buffers.
-     */
-    protected void printJavadocOutput() {
-        System.out.println(STANDARD_OUTPUT + " : \n" + getStandardOutput());
-        System.err.println(ERROR_OUTPUT + " : \n" + getErrorOutput());
-        System.err.println(WARNING_OUTPUT + " : \n" + getWarningOutput());
-        System.out.println(NOTICE_OUTPUT + " : \n" + getNoticeOutput());
-    }
-
-    /**
-     * Read the file and return it as a string.
-     *
-     * @param fileName  the name of the file to read
-     * @return          the file in string format
-     */
-    public String readFileToString(String fileName) throws Error {
-        return readFileToString(outputDir, fileName);
-    }
-
-    /**
-     * Read the file and return it as a string.
-     *
-     * @param baseDir   the directory in which to locate the file
-     * @param fileName  the name of the file to read
-     * @return          the file in string format
-     */
-    private String readFileToString(File baseDir, String fileName) throws Error {
-        switch (fileName) {
-            case ERROR_OUTPUT:
-                return getErrorOutput();
-            case NOTICE_OUTPUT:
-                return getNoticeOutput();
-            case WARNING_OUTPUT:
-                return getWarningOutput();
-            case STANDARD_OUTPUT:
-                return getStandardOutput();
-        }
-        try {
-            File file = new File(baseDir, fileName);
-            if ( !file.exists() ) {
-                System.out.println("\n" + "FILE DOES NOT EXIST: " + fileName);
-            }
-            char[] allChars;
-            try (BufferedReader in = new BufferedReader(new FileReader(file))) {
-                // Create an array of characters the size of the file
-                allChars = new char[(int)file.length()];
-                // Read the characters into the allChars array
-                in.read(allChars, 0, (int)file.length());
-            }
-
-            // Convert to a string
-            String allCharsString = new String(allChars);
-            return allCharsString;
-        } catch (FileNotFoundException e) {
-            System.err.println(e);
-            throw new Error("File not found: " + fileName);
-        } catch (IOException e) {
-            System.err.println(e);
-            throw new Error("Error reading file: " + fileName);
-        }
-    }
-
-    /**
-     * Compare the two given files.
-     *
-     * @param baseDir1 the directory in which to locate the first file
-     * @param baseDir2 the directory in which to locate the second file
-     * @param file the file to compare in the two base directories
-     * @param throwErrorIFNoMatch flag to indicate whether or not to throw
-     * an error if the files do not match.
-     * @return true if the files are the same and false otherwise.
-     */
-    private boolean diff(File baseDir1, File baseDir2, String file,
-            boolean throwErrorIFNoMatch) throws Error {
-        String file1Contents = readFileToString(baseDir1, file);
-        String file2Contents = readFileToString(baseDir2, file);
-        numTestsRun++;
-        if (file1Contents.trim().compareTo(file2Contents.trim()) == 0) {
-            System.out.println("Diff successful: " + new File(baseDir1, file) + ", " + new File(baseDir2, file));
-            numTestsPassed++;
-            return true;
-        } else if (throwErrorIFNoMatch) {
-            throw new Error("Diff failed: " + new File(baseDir1, file) + ", " + new File(baseDir2, file));
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * Search for the string in the given file and return true
-     * if the string was found.
-     *
-     * @param fileString    the contents of the file to search through
-     * @param stringToFind  the string to search for
-     * @return              true if the string was found
-     */
-    private boolean findString(String fileString, String stringToFind) {
-        return fileString.contains(stringToFind.replace("\n", NL));
-    }
-
-
-    /**
-     * Return the standard output.
-     * @return the standard output
-     */
-    public String getStandardOutput() {
-        return standardOut.toString();
-    }
-
-    /**
-     * Return the error output.
-     * @return the error output
-     */
-    public String getErrorOutput() {
-        return errors.getBuffer().toString();
-    }
-
-    /**
-     * Return the notice output.
-     * @return the notice output
-     */
-    public String getNoticeOutput() {
-        return notices.getBuffer().toString();
-    }
-
-    /**
-     * Return the warning output.
-     * @return the warning output
-     */
-    public String getWarningOutput() {
-        return warnings.getBuffer().toString();
-    }
-
-    /**
      * A utility to copy a directory from one place to another.
-     * We may possibly want to move this to our doclet toolkit in
-     * the near future and maintain it from there.
      *
      * @param targetDir the directory to copy.
      * @param destDir the destination to copy the directory to.
      */
-    public static void copyDir(String targetDir, String destDir) {
-        if (targetDir.endsWith("SCCS")) {
-            return;
-        }
+    // TODO: convert to using java.nio.Files.walkFileTree
+    public void copyDir(String targetDir, String destDir) {
         try {
             File targetDirObj = new File(targetDir);
             File destDirParentObj = new File(destDir);
@@ -617,7 +498,7 @@
                 File srcFile = new File(targetDirObj, file);
                 File destFile = new File(destDirObj, file);
                 if (srcFile.isFile()) {
-                    System.out.println("Copying " + srcFile + " to " + destFile);
+                    out.println("Copying " + srcFile + " to " + destFile);
                     copyFile(destFile, srcFile);
                 } else if(srcFile.isDirectory()) {
                     copyDir(srcFile.getAbsolutePath(), destDirObj.getAbsolutePath());
@@ -633,25 +514,235 @@
      *
      * @param destfile the destination file
      * @param srcfile the source file
-     * @throws SecurityException
      * @throws IOException
      */
-    public static void copyFile(File destfile, File srcfile)
-        throws IOException {
-        byte[] bytearr = new byte[512];
-        int len;
-        FileInputStream input = new FileInputStream(srcfile);
-        File destDir = destfile.getParentFile();
-        destDir.mkdirs();
-        FileOutputStream output = new FileOutputStream(destfile);
+    public void copyFile(File destfile, File srcfile) throws IOException {
+        Files.copy(srcfile.toPath(), destfile.toPath());
+    }
+
+    /**
+     * Read a file from the output directory.
+     *
+     * @param fileName  the name of the file to read
+     * @return          the file in string format
+     */
+    public String readOutputFile(String fileName) throws Error {
+        return readFile(outputDir, fileName);
+    }
+
+    protected String readFile(String fileName) throws Error {
+        return readFile(outputDir, fileName);
+    }
+
+    protected String readFile(String baseDir, String fileName) throws Error {
+        return readFile(new File(baseDir), fileName);
+    }
+
+    /**
+     * Read the file and return it as a string.
+     *
+     * @param baseDir   the directory in which to locate the file
+     * @param fileName  the name of the file to read
+     * @return          the file in string format
+     */
+    private String readFile(File baseDir, String fileName) throws Error {
         try {
-            while ((len = input.read(bytearr)) != -1) {
-                output.write(bytearr, 0, len);
+            File file = new File(baseDir, fileName);
+            SoftReference<String> ref = fileContentCache.get(file);
+            String content = (ref == null) ? null : ref.get();
+            if (content != null)
+                return content;
+
+            content = new String(Files.readAllBytes(file.toPath()));
+            fileContentCache.put(file, new SoftReference(content));
+            return content;
+        } catch (FileNotFoundException e) {
+            System.err.println(e);
+            throw new Error("File not found: " + fileName);
+        } catch (IOException e) {
+            System.err.println(e);
+            throw new Error("Error reading file: " + fileName);
+        }
+    }
+
+    protected void checking(String message) {
+        numTestsRun++;
+        print("Starting subtest " + numTestsRun, message);
+    }
+
+    protected void passed(String message) {
+        numTestsPassed++;
+        print("Passed", message);
+    }
+
+    protected void failed(String message) {
+        print("FAILED", message);
+    }
+
+    private void print(String prefix, String message) {
+        if (message.isEmpty())
+            out.println(prefix);
+        else {
+            out.print(prefix);
+            out.print(": ");
+            out.println(message.replace("\n", NL));
+        }
+    }
+
+    /**
+     * Print a summary of the test results.
+     */
+    protected void printSummary() {
+//        log.write();
+        if (numTestsRun != 0 && numTestsPassed == numTestsRun) {
+            // Test passed
+            out.println();
+            out.println("All " + numTestsPassed + " subtests passed");
+        } else {
+            // Test failed
+            throw new Error((numTestsRun - numTestsPassed)
+                    + " of " + (numTestsRun)
+                    + " subtests failed");
+        }
+    }
+
+    /**
+     * Search for the string in the given file and return true
+     * if the string was found.
+     *
+     * @param fileString    the contents of the file to search through
+     * @param stringToFind  the string to search for
+     * @return              true if the string was found
+     */
+    private boolean findString(String fileString, String stringToFind) {
+        // javadoc (should) always use the platform newline sequence,
+        // but in the strings to find it is more convenient to use the Java
+        // newline character. So we translate \n to NL before we search.
+        stringToFind = stringToFind.replace("\n", NL);
+        return fileString.contains(stringToFind);
+    }
+
+    /**
+     * Compare the two given files.
+     *
+     * @param baseDir1 the directory in which to locate the first file
+     * @param baseDir2 the directory in which to locate the second file
+     * @param file the file to compare in the two base directories
+     * @param throwErrorIFNoMatch flag to indicate whether or not to throw
+     * an error if the files do not match.
+     * @return true if the files are the same and false otherwise.
+     */
+    private void diff(File baseDir1, File baseDir2, String file) {
+        String file1Contents = readFile(baseDir1, file);
+        String file2Contents = readFile(baseDir2, file);
+        checking("diff " + new File(baseDir1, file) + ", " + new File(baseDir2, file));
+        if (file1Contents.trim().compareTo(file2Contents.trim()) == 0) {
+            passed("files are equal");
+        } else {
+            failed("files differ");
+        }
+    }
+
+    /**
+     * Utility class to simplify the handling of temporarily setting a
+     * new stream for System.out or System.err.
+     */
+    private static class StreamOutput {
+        // functional interface to set a stream.
+        private interface Initializer {
+            void set(PrintStream s);
+        }
+
+        private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        private final PrintStream ps = new PrintStream(baos);
+        private final PrintStream prev;
+        private final Initializer init;
+
+        StreamOutput(PrintStream s, Initializer init) {
+            prev = s;
+            init.set(ps);
+            this.init = init;
+        }
+
+        String close() {
+            init.set(prev);
+            ps.close();
+            return baos.toString();
+        }
+    }
+
+    /**
+     * Utility class to simplify the handling of creating an in-memory PrintWriter.
+     */
+    private static class WriterOutput {
+        private final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+        String close() {
+            pw.close();
+            return sw.toString();
+        }
+    }
+
+
+//    private final Logger log = new Logger();
+
+    //--------- Logging --------------------------------------------------------
+    //
+    // This class writes out the details of calls to checkOutput and checkFile
+    // in a canonical way, so that the resulting file can be checked against
+    // similar files from other versions of JavadocTester using the same logging
+    // facilities.
+
+    static class Logger {
+        private static final int PREFIX = 40;
+        private static final int SUFFIX = 20;
+        private static final int MAX = PREFIX + SUFFIX;
+        List<String> tests = new ArrayList<>();
+        String outDir;
+        String rootDir = rootDir();
+
+        static String rootDir() {
+            File f = new File(".").getAbsoluteFile();
+            while (!new File(f, ".hg").exists())
+                f = f.getParentFile();
+            return f.getPath();
+        }
+
+        void setOutDir(File outDir) {
+            this.outDir = outDir.getPath();
+        }
+
+        void logCheckFile(String file, boolean positive) {
+            // Strip the outdir because that will typically not be the same
+            if (file.startsWith(outDir + "/"))
+                file = file.substring(outDir.length() + 1);
+            tests.add(file + " " + positive);
+        }
+
+        void logCheckOutput(String file, boolean positive, String text) {
+            // Compress the string to be displayed in the log file
+            String simpleText = text.replaceAll("\\s+", " ").replace(rootDir, "[ROOT]");
+            if (simpleText.length() > MAX)
+                simpleText = simpleText.substring(0, PREFIX)
+                        + "..." + simpleText.substring(simpleText.length() - SUFFIX);
+            // Strip the outdir because that will typically not be the same
+            if (file.startsWith(outDir + "/"))
+                file = file.substring(outDir.length() + 1);
+            // The use of text.hashCode ensure that all of "text" is taken into account
+            tests.add(file + " " + positive + " " + text.hashCode() + " " + simpleText);
+        }
+
+        void write() {
+            // sort the log entries because the subtests may not be executed in the same order
+            tests.sort((a, b) -> a.compareTo(b));
+            try (BufferedWriter bw = new BufferedWriter(new FileWriter("tester.log"))) {
+                for (String t: tests) {
+                    bw.write(t);
+                    bw.newLine();
+                }
+            } catch (IOException e) {
+                throw new Error("problem writing log: " + e);
             }
-        } catch (FileNotFoundException | SecurityException exc) {
-        } finally {
-            input.close();
-            output.close();
         }
     }
 }
--- a/test/com/sun/javadoc/testAbsLinkPath/TestAbsLinkPath.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testAbsLinkPath/TestAbsLinkPath.java	Fri May 09 15:37:12 2014 -0700
@@ -26,33 +26,31 @@
  * @bug 4640745
  * @summary This test verifys that the -link option handles absolute paths.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestAbsLinkPath
  * @run main TestAbsLinkPath
  */
 
 public class TestAbsLinkPath extends JavadocTester {
 
-    private static final String[][] TEST = {
-        { "pkg1/C1.html", "C2.html"}};
+    public static void main(String... args) throws Exception {
+        TestAbsLinkPath tester = new TestAbsLinkPath();
+        tester.runTests();
+    }
 
-    private static final String[] ARGS1 =
-        new String[] {
-            "-d", "tmp2", "-sourcepath", SRC_DIR, "pkg2"};
-    private static final String[] ARGS2 =
-        new String[] {
-            "-d", "tmp", "-sourcepath", SRC_DIR,
-            "-link", "../tmp2", "pkg1"};
+    @Test
+    void test1() {
+        String out1 = "out1";
+        javadoc("-d", out1, "-sourcepath", testSrc, "pkg2");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestAbsLinkPath tester = new TestAbsLinkPath();
-        tester.run(ARGS1, NO_TEST, NO_TEST);
-        tester.run(ARGS2,  TEST, NO_TEST);
-        tester.printSummary();
+        javadoc("-d", "out2",
+                "-sourcepath", testSrc,
+                "-link", "../" + out1,
+                "pkg1");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg1/C1.html", true,
+                "C2.html");
     }
 }
--- a/test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testAbstractMethod/TestAbstractMethod.java	Fri May 09 15:37:12 2014 -0700
@@ -27,80 +27,72 @@
  * @summary  Make sure that the abstract method is identified correctly
  *           if the abstract modifier is present explicitly or implicitly.
  * @author   bpatel
- * @library  ../lib/
- * @build    JavadocTester TestAbstractMethod
+ * @library  ../lib
+ * @build    JavadocTester
  * @run main TestAbstractMethod
  */
 
 public class TestAbstractMethod extends JavadocTester {
 
-    //Test information.
+    public static void main(String... args) throws Exception {
+        TestAbstractMethod tester = new TestAbstractMethod();
+        tester.runTests();
+    }
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "pkg/A.html",
-            "<td class=\"colFirst\"><code>default void</code></td>"},
-        { "pkg/A.html",
-            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
-            "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
-            "<span id=\"t2\" class=\"tableTab\"><span>" +
-            "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
-            "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
-            "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>" +
-            "</span><span id=\"t5\" class=\"tableTab\"><span>" +
-            "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
-        { "pkg/B.html",
-            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
-            "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
-            "<span id=\"t2\" class=\"tableTab\"><span>" +
-            "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
-            "class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract " +
-            "Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>" +
-            "<span id=\"t4\" class=\"tableTab\"><span>" +
-            "<a href=\"javascript:show(8);\">Concrete Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
-        { "pkg/B.html",
-            "<td class=\"colFirst\"><code>abstract void</code></td>"},
-        { "pkg/C.html",
-            "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
-            "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
-            "<span id=\"t2\" class=\"tableTab\"><span>" +
-            "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span></span>" +
-            "<span id=\"t5\" class=\"tableTab\"><span>" +
-            "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
-        { "pkg/C.html",
-            "<td class=\"colFirst\"><code>default void</code></td>"}
-    };
-    private static final String[][] NEGATED_TEST = {
-        { "pkg/A.html",
-            "<td class=\"colFirst\"><code>abstract void</code></td>"},
-        { "pkg/B.html",
-            "<span><a href=\"javascript:show(16);\">Default Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span>"},
-        { "pkg/B.html",
-            "<td class=\"colFirst\"><code>default void</code></td>"},
-        { "pkg/C.html",
-            "<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>" +
-            "<span class=\"tabEnd\">&nbsp;</span>"}
-    };
+        checkOutput("pkg/A.html", true,
+                "<td class=\"colFirst\"><code>default void</code></td>",
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+                + "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t2\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
+                + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">"
+                + "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>"
+                + "</span><span id=\"t5\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span></caption>");
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestAbstractMethod tester = new TestAbstractMethod();
-        tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("pkg/B.html", true,
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+                + "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t2\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" "
+                + "class=\"tableTab\"><span><a href=\"javascript:show(4);\">Abstract "
+                + "Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t4\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:show(8);\">Concrete Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
+                "<td class=\"colFirst\"><code>abstract void</code></td>");
+
+        checkOutput("pkg/C.html", true,
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>"
+                + "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t2\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:show(2);\">Instance Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t5\" class=\"tableTab\"><span>"
+                + "<a href=\"javascript:show(16);\">Default Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></span></caption>",
+                "<td class=\"colFirst\"><code>default void</code></td>");
+
+        checkOutput("pkg/A.html", false,
+                "<td class=\"colFirst\"><code>abstract void</code></td>");
+
+        checkOutput("pkg/B.html", false,
+                "<span><a href=\"javascript:show(16);\">Default Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span>",
+                "<td class=\"colFirst\"><code>default void</code></td>");
+
+        checkOutput("pkg/C.html", false,
+                "<span><a href=\"javascript:show(4);\">Abstract Methods</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span>");
     }
 }
--- a/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java	Fri May 09 15:37:12 2014 -0700
@@ -26,250 +26,136 @@
  * @bug 8025633 8025524
  * @summary Test for valid name attribute in HTML anchors.
  * @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestAnchorNames
+ * @library ../lib
+ * @build JavadocTester
  * @run main TestAnchorNames
  */
 
 public class TestAnchorNames extends JavadocTester {
 
+    private static final String[] ARGS = new String[] {
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-
-        //Test some section markers and links to these markers
-
-        { "pkg1/RegClass.html",
-            "<a name=\"skip.navbar.top\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"nested.class.summary\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"#nested.class.summary\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"method.summary\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"#method.summary\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"field.detail\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"#field.detail\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"constructor.detail\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"#constructor.detail\">"
-        },
-
-        //Test some members and link to these members
-
-        //The marker for this appears in the serialized-form.html which we will
-        //test below
-        { "pkg1/RegClass.html",
-            "<a href=\"../serialized-form.html#pkg1.RegClass\">"
-        },
-        //Test some fields
-        { "pkg1/RegClass.html",
-            "<a name=\"Z:Z_\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#Z:Z_\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"Z:Z_:D\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"Z:Z:D_\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"Z:Z:Dfield\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"fieldInCla:D:D\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"S_:D:D:D:D:DINT\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"method:D:D\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#method:D:D\">"
-        },
-        { "pkg1/DeprMemClass.html",
-            "<a name=\"Z:Z_field_In_Class\">"
-        },
-        { "pkg1/DeprMemClass.html",
-            "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
-        },
-        //Test constructor
-        { "pkg1/RegClass.html",
-            "<a name=\"RegClass-java.lang.String-int-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">"
-        },
-        //Test some methods
-        { "pkg1/RegClass.html",
-            "<a name=\"Z:Z_methodInClass-java.lang.String-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"method--\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#method--\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"foo-java.util.Map-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"methodInCla:Ds-java.lang.String:A-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"methodD-pkg1.RegClass.:DA-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a name=\"methodD-pkg1.RegClass.D:A-\">"
-        },
-        { "pkg1/RegClass.html",
-            "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">"
-        },
-        { "pkg1/DeprMemClass.html",
-            "<a name=\"Z:Z:Dmethod_In_Class--\">"
-        },
-        { "pkg1/DeprMemClass.html",
-            "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
-        },
-
-        //Test enum
-
-        { "pkg1/RegClass.Te$t_Enum.html",
-            "<a name=\"Z:Z:DFLD2\">"
-        },
-        { "pkg1/RegClass.Te$t_Enum.html",
-            "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">"
-        },
-
-        //Test nested class
-
-        { "pkg1/RegClass._NestedClas$.html",
-            "<a name=\"Z:Z_NestedClas:D--\">"
-        },
-        { "pkg1/RegClass._NestedClas$.html",
-            "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">"
-        },
-
-        //Test class use page
-
-        { "pkg1/class-use/DeprMemClass.html",
-            "<a href=\"../../pkg1/RegClass.html#d____mc\">"
-        },
-
-        //Test deprecated list page
-
-        { "deprecated-list.html",
-            "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
-        },
-        { "deprecated-list.html",
-            "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
-        },
-
-        //Test constant values page
-
-        { "constant-values.html",
-            "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
-        },
-
-        //Test serialized form page
-
-        //This is the marker for the link that appears in the pkg1.RegClass.html page
-        { "serialized-form.html",
-            "<a name=\"pkg1.RegClass\">"
-        },
-
-        //Test member name index page
-
-        { "index-all.html",
-            "<a name=\"I:Z:Z:D\">"
-        },
-        { "index-all.html",
-            "<a href=\"#I:Z:Z:D\">$"
-        },
-        { "index-all.html",
-            "<a href=\"#I:Z:Z_\">_"
-        }
     };
 
-    private static final String[][] NEGATED_TEST = {
-        //The marker name conversion should only affect HTML anchors. It should not
-        //affect the lables.
-        { "pkg1/RegClass.html",
-            " Z:Z_"
-        },
-        { "pkg1/RegClass.html",
-            " Z:Z:Dfield"
-        },
-        { "pkg1/RegClass.html",
-            " Z:Z_field_In_Class"
-        },
-        { "pkg1/RegClass.html",
-            " S_:D:D:D:D:DINT"
-        },
-    };
-
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1"
-    };
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
     public static void main(String[] args) throws Exception {
         TestAnchorNames tester = new TestAnchorNames();
-        tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.printSummary();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-use",
+                "pkg1");
+        checkExit(Exit.OK);
+
+        // Test some section markers and links to these markers
+        checkOutput("pkg1/RegClass.html", true,
+                "<a name=\"skip.navbar.top\">",
+                "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">",
+                "<a name=\"nested.class.summary\">",
+                "<a href=\"#nested.class.summary\">",
+                "<a name=\"method.summary\">",
+                "<a href=\"#method.summary\">",
+                "<a name=\"field.detail\">",
+                "<a href=\"#field.detail\">",
+                "<a name=\"constructor.detail\">",
+                "<a href=\"#constructor.detail\">");
+
+        // Test some members and link to these members
+        checkOutput("pkg1/RegClass.html", true,
+                //The marker for this appears in the serialized-form.html which we will
+                //test below
+                "<a href=\"../serialized-form.html#pkg1.RegClass\">");
+
+        // Test some fields
+        checkOutput("pkg1/RegClass.html", true,
+                "<a name=\"Z:Z_\">",
+                "<a href=\"../pkg1/RegClass.html#Z:Z_\">",
+                "<a name=\"Z:Z_:D\">",
+                "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">",
+                "<a name=\"Z:Z:D_\">",
+                "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">",
+                "<a name=\"Z:Z:Dfield\">",
+                "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">",
+                "<a name=\"fieldInCla:D:D\">",
+                "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">",
+                "<a name=\"S_:D:D:D:D:DINT\">",
+                "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">",
+                "<a name=\"method:D:D\">",
+                "<a href=\"../pkg1/RegClass.html#method:D:D\">");
+
+        checkOutput("pkg1/DeprMemClass.html", true,
+                "<a name=\"Z:Z_field_In_Class\">",
+                "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">");
+
+        // Test constructor
+        checkOutput("pkg1/RegClass.html", true,
+                "<a name=\"RegClass-java.lang.String-int-\">",
+                "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">");
+
+        // Test some methods
+        checkOutput("pkg1/RegClass.html", true,
+                "<a name=\"Z:Z_methodInClass-java.lang.String-\">",
+                "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">",
+                "<a name=\"method--\">",
+                "<a href=\"../pkg1/RegClass.html#method--\">",
+                "<a name=\"foo-java.util.Map-\">",
+                "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">",
+                "<a name=\"methodInCla:Ds-java.lang.String:A-\">",
+                "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">",
+                "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">",
+                "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">",
+                "<a name=\"methodD-pkg1.RegClass.:DA-\">",
+                "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">",
+                "<a name=\"methodD-pkg1.RegClass.D:A-\">",
+                "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">");
+
+        checkOutput("pkg1/DeprMemClass.html", true,
+                "<a name=\"Z:Z:Dmethod_In_Class--\">",
+                "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">");
+
+        // Test enum
+        checkOutput("pkg1/RegClass.Te$t_Enum.html", true,
+                "<a name=\"Z:Z:DFLD2\">",
+                "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">");
+
+        // Test nested class
+        checkOutput("pkg1/RegClass._NestedClas$.html", true,
+                "<a name=\"Z:Z_NestedClas:D--\">",
+                "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">");
+
+        // Test class use page
+        checkOutput("pkg1/class-use/DeprMemClass.html", true,
+                "<a href=\"../../pkg1/RegClass.html#d____mc\">");
+
+        // Test deprecated list page
+        checkOutput("deprecated-list.html", true,
+                "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">",
+                "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">");
+
+        // Test constant values page
+        checkOutput("constant-values.html", true,
+                "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">");
+
+        // Test serialized form page
+        checkOutput("serialized-form.html", true,
+                //This is the marker for the link that appears in the pkg1.RegClass.html page
+                "<a name=\"pkg1.RegClass\">");
+
+        // Test member name index page
+        checkOutput("index-all.html", true,
+                "<a name=\"I:Z:Z:D\">",
+                "<a href=\"#I:Z:Z:D\">$",
+                "<a href=\"#I:Z:Z_\">_");
+
+        // The marker name conversion should only affect HTML anchors. It should not
+        // affect the lables.
+        checkOutput("pkg1/RegClass.html", false,
+                " Z:Z_",
+                " Z:Z:Dfield",
+                " Z:Z_field_In_Class",
+                " S_:D:D:D:D:DINT");
     }
 }
--- a/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java	Fri May 09 15:37:12 2014 -0700
@@ -27,32 +27,26 @@
  * @summary  Make sure that annotations types with optional elements have
  *           element headers
  * @author   Mahmood Ali
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestAnnotationOptional
  * @run main TestAnnotationOptional
  */
 
 public class TestAnnotationOptional extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestAnnotationOptional tester = new TestAnnotationOptional();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "pkg/AnnotationOptional.html",
-            "<a name=\"annotation.type.element.detail\">"
-        }
-    };
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestAnnotationOptional tester = new TestAnnotationOptional();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg/AnnotationOptional.html", true,
+            "<a name=\"annotation.type.element.detail\">");
     }
 }
--- a/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java	Fri May 09 15:37:12 2014 -0700
@@ -27,64 +27,52 @@
  * @summary  Make sure that annotation types with 0 members does not have
  *           extra HR tags.
  * @author   jamieh
- * @library  ../lib/
- * @build    JavadocTester TestAnnotationTypes
+ * @library  ../lib
+ * @build    JavadocTester
  * @run main TestAnnotationTypes
  */
 
 public class TestAnnotationTypes extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestAnnotationTypes tester = new TestAnnotationTypes();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "pkg/AnnotationTypeField.html",
-            "<li>Summary:&nbsp;</li>\n" +
-            "<li><a href=\"#annotation.type." +
-            "field.summary\">Field</a>&nbsp;|&nbsp;</li>"},
-        { "pkg/AnnotationTypeField.html",
-            "<li>Detail:&nbsp;</li>\n" +
-            "<li><a href=\"#annotation.type." +
-            "field.detail\">Field</a>&nbsp;|&nbsp;</li>"},
-        { "pkg/AnnotationTypeField.html",
-            "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"},
-        { "pkg/AnnotationTypeField.html",
-            "<h3>Field Summary</h3>"},
-        { "pkg/AnnotationTypeField.html",
-            "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../" +
-            "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>" +
-            "</code>&nbsp;</td>"},
-        { "pkg/AnnotationTypeField.html",
-            "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->"},
-        { "pkg/AnnotationTypeField.html",
-            "<h4>DEFAULT_NAME</h4>\n" +
-            "<pre>public static final&nbsp;java." +
-            "lang.String&nbsp;DEFAULT_NAME</pre>"},
-        { "pkg/AnnotationType.html",
-            "<li>Summary:&nbsp;</li>\n" +
-            "<li>Field&nbsp;|&nbsp;</li>"},
-        { "pkg/AnnotationType.html",
-            "<li>Detail:&nbsp;</li>\n" +
-            "<li>Field&nbsp;|&nbsp;</li>"},
-    };
-    private static final String[][] NEGATED_TEST = {
-        { "pkg/AnnotationType.html",
-            "<HR>\n\n" +
-            "<P>\n\n" +
-            "<P>" +
-            "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>"}
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestAnnotationTypes tester = new TestAnnotationTypes();
-        tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("pkg/AnnotationTypeField.html", true,
+                "<li>Summary:&nbsp;</li>\n"
+                + "<li><a href=\"#annotation.type."
+                + "field.summary\">Field</a>&nbsp;|&nbsp;</li>",
+                "<li>Detail:&nbsp;</li>\n"
+                + "<li><a href=\"#annotation.type."
+                + "field.detail\">Field</a>&nbsp;|&nbsp;</li>",
+                "<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->",
+                "<h3>Field Summary</h3>",
+                "<td class=\"colLast\"><code><span class=\"memberNameLink\"><a href=\"../"
+                + "pkg/AnnotationTypeField.html#DEFAULT_NAME\">DEFAULT_NAME</a></span>"
+                + "</code>&nbsp;</td>",
+                "<!-- ============ ANNOTATION TYPE FIELD DETAIL =========== -->",
+                "<h4>DEFAULT_NAME</h4>\n"
+                + "<pre>public static final&nbsp;java."
+                + "lang.String&nbsp;DEFAULT_NAME</pre>");
+
+        checkOutput("pkg/AnnotationType.html", true,
+                "<li>Summary:&nbsp;</li>\n"
+                + "<li>Field&nbsp;|&nbsp;</li>",
+                "<li>Detail:&nbsp;</li>\n"
+                + "<li>Field&nbsp;|&nbsp;</li>");
+
+        checkOutput("pkg/AnnotationType.html", false,
+                "<HR>\n\n"
+                + "<P>\n\n"
+                + "<P>"
+                + "<!-- ========= END OF CLASS DATA ========= -->" + "<HR>");
     }
 }
--- a/test/com/sun/javadoc/testBackSlashInLink/TestBackSlashInLink.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testBackSlashInLink/TestBackSlashInLink.java	Fri May 09 15:37:12 2014 -0700
@@ -27,28 +27,27 @@
  * @summary Test to make sure that the link to source documentation
  * has a forward slash.  It would be wrong to use a back slash.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestBackSlashInLink
  * @run main TestBackSlashInLink
  */
 
 public class TestBackSlashInLink extends JavadocTester {
 
-    private static final String[][] TEST = {
-        { "C.html", "src-html/C.html#line.7"}};
-    private static final String[] ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-            "-linksource",  SRC_DIR + "/C.java"};
+    public static void main(String... args) throws Exception {
+        TestBackSlashInLink tester = new TestBackSlashInLink();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestBackSlashInLink tester = new TestBackSlashInLink();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-linksource",
+                testSrc("C.java"));
+        checkExit(Exit.OK);
+
+        checkOutput("C.html", true,
+                "src-html/C.html#line.7");
     }
 }
--- a/test/com/sun/javadoc/testBadPackageFileInJar/TestBadPackageFileInJar.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testBadPackageFileInJar/TestBadPackageFileInJar.java	Fri May 09 15:37:12 2014 -0700
@@ -27,33 +27,27 @@
  * @summary Test to make sure that Javadoc emits a useful warning
  * when a bad package.html file is in the JAR.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestBadPackageFileInJar
  * @run main TestBadPackageFileInJar
  */
 
 public class TestBadPackageFileInJar extends JavadocTester {
 
-    private static final String[][] TEST =
-        new String[][] {
-            {ERROR_OUTPUT,
-                "badPackageFileInJar.jar" + FS + "pkg/package.html: error - Body tag missing from HTML"}
-        };
+    public static void main(String... args) throws Exception {
+        TestBadPackageFileInJar tester = new TestBadPackageFileInJar();
+        tester.runTests();
+    }
 
-    private static final String[] ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-classpath",
-            SRC_DIR + "/badPackageFileInJar.jar", "pkg"};
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-classpath",  testSrc("badPackageFileInJar.jar"),
+                "pkg");
+        checkExit(Exit.FAILED);
 
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestBadPackageFileInJar tester = new TestBadPackageFileInJar();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput(Output.ERROR, true,
+                "badPackageFileInJar.jar" + FS + "pkg/package.html: error - Body tag missing from HTML");
     }
 }
--- a/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testBadSourceFile/TestBadSourceFile.java	Fri May 09 15:37:12 2014 -0700
@@ -27,27 +27,28 @@
  * @summary  Make sure exception is not thrown if there is a bad source
  *           file in the same directory as the file being documented.
  * @author   jamieh
- * @library  ../lib/
+ * @library ../lib
  * @build    JavadocTester
- * @build    TestBadSourceFile
  * @run main TestBadSourceFile
  */
 
 public class TestBadSourceFile extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-Xdoclint:none", "-d", OUTPUT_DIR, SRC_DIR + "/C2.java"
-    };
-
     /**
      * The entry point of the test.
-     * @param args the array of command line arguments.
+     * @param args the array of command line arguments
+     * @throws Exception if the test fails
      */
-    public static void main(String[] args) {
+    public static void main(String... args) throws Exception {
         TestBadSourceFile tester = new TestBadSourceFile();
-        int exitCode = tester.run(ARGS, NO_TEST, NO_TEST);
-        tester.checkExitCode(0, exitCode);
-        tester.printSummary();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-Xdoclint:none",
+                "-d", "out",
+                testSrc("C2.java"));
+        checkExit(Exit.OK);
     }
 }
--- a/test/com/sun/javadoc/testBaseClass/TestBaseClass.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testBaseClass/TestBaseClass.java	Fri May 09 15:37:12 2014 -0700
@@ -26,29 +26,25 @@
  * @bug 4197513
  * @summary Javadoc does not process base class.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build BaseClass
  * @build JavadocTester
- * @build TestBaseClass
  * @run main TestBaseClass
  */
 
 public class TestBaseClass extends JavadocTester {
 
-    private static final String[] ARGS =
-        new String[] {
-            "-sourcepath", SRC_DIR,
-            "-docletpath", SRC_DIR, "-doclet", "BaseClass",
-            SRC_DIR + "/Bar.java", "baz"};
+    public static void main(String... args) throws Exception {
+        TestBaseClass tester = new TestBaseClass();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestBaseClass tester = new TestBaseClass();
-        if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
-            throw new Error("Javadoc failed to execute.");
-        }
+    @Test
+    void test() {
+        javadoc("-sourcepath", testSrc,
+                "-docletpath", testSrc,
+                "-doclet", "BaseClass",
+                testSrc("Bar.java"), "baz");
+        checkExit(Exit.OK);
     }
 }
--- a/test/com/sun/javadoc/testBreakIterator/TestBreakIterator.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testBreakIterator/TestBreakIterator.java	Fri May 09 15:37:12 2014 -0700
@@ -29,29 +29,27 @@
  * Correct Answer: "The class is empty (i.e. it has no members)."
  * Wrong Answer: "The class is empty (i.e."
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestBreakIterator
  * @run main TestBreakIterator
  */
 
 public class TestBreakIterator extends JavadocTester {
 
-    private static final String[][] TEST = {
-        { "pkg/BreakIteratorTest.html",
-            "The class is empty (i.e. it has no members)."}};
-    private static final String[] ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-            "-breakiterator", "pkg"};
+    public static void main(String... args) throws Exception {
+        TestBreakIterator tester = new TestBreakIterator();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestBreakIterator tester = new TestBreakIterator();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-breakiterator",
+                "pkg");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg/BreakIteratorTest.html", true,
+            "The class is empty (i.e. it has no members).");
     }
 }
--- a/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java	Fri May 09 15:37:12 2014 -0700
@@ -26,9 +26,8 @@
  * @bug      4979486
  * @summary  Make sure tool parses CR line separators properly.
  * @author   jamieh
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestCRLineSeparator
  * @run main TestCRLineSeparator
  */
 
@@ -37,32 +36,27 @@
 
 public class TestCRLineSeparator extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", ".", "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestCRLineSeparator tester = new TestCRLineSeparator();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "pkg/MyClass.html", "Line 1\n" +
-        " Line 2"}
-    };
+    @Test
+    void test() throws IOException {
+        initFiles(new File(testSrc), new File("src"), "pkg");
+        javadoc("-d", "out",
+                "-sourcepath", "src",
+                "pkg");
+        checkExit(Exit.OK);
 
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) throws Exception {
-        initFiles(new File(SRC_DIR), new File("."), "pkg");
-        TestCRLineSeparator tester = new TestCRLineSeparator();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("pkg/MyClass.html", true,
+                "Line 1\n"
+                + " Line 2");
     }
 
     // recursively copy files from fromDir to toDir, replacing newlines
     // with \r
-    static void initFiles(File fromDir, File toDir, String f) throws IOException {
+    void initFiles(File fromDir, File toDir, String f) throws IOException {
         File from_f = new File(fromDir, f);
         File to_f = new File(toDir, f);
         if (from_f.isDirectory()) {
@@ -71,23 +65,17 @@
                 initFiles(from_f, to_f, child);
             }
         } else {
-            List<String> lines = new ArrayList<String>();
-            BufferedReader in = new BufferedReader(new FileReader(from_f));
-            try {
+            List<String> lines = new ArrayList<>();
+            try (BufferedReader in = new BufferedReader(new FileReader(from_f))) {
                 String line;
                 while ((line = in.readLine()) != null)
                     lines.add(line);
-            } finally {
-                in.close();
             }
-            BufferedWriter out = new BufferedWriter(new FileWriter(to_f));
-            try {
+            try (BufferedWriter out = new BufferedWriter(new FileWriter(to_f))) {
                 for (String line: lines) {
                     out.write(line);
                     out.write("\r");
                 }
-            } finally {
-                out.close();
             }
         }
     }
--- a/test/com/sun/javadoc/testCharset/TestCharset.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testCharset/TestCharset.java	Fri May 09 15:37:12 2014 -0700
@@ -27,39 +27,34 @@
  * @summary  Run a test on -charset to make sure the charset gets generated as a
  *           part of the meta tag.
  * @author   Bhavesh Patel
- * @library  ../lib/
- * @build    JavadocTester TestCharset
+ * @library  ../lib
+ * @build    JavadocTester
  * @run main TestCharset
  */
 
 public class TestCharset extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-charset", "UTF-8", "-sourcepath", SRC_DIR, "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestCharset tester = new TestCharset();
+        tester.runTests();
+    }
 
-    private static final String[][] TEST = {
-        { "index.html",
-            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"},
-        { "pkg/Foo.html",
-            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">"}
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-charset", "UTF-8",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-    private static final String[][] NEGATED_TEST = {
-        { "index.html",
-            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"},
-        { "pkg/Foo.html",
-            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">"}
-    };
+        checkOutput("index.html", true,
+            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
+        checkOutput("pkg/Foo.html", true,
+            "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestCharset tester = new TestCharset();
-        tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("index.html", false,
+            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
+        checkOutput("pkg/Foo.html", false,
+            "<meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"UTF-8\">");
     }
 }
--- a/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java	Fri May 09 15:37:12 2014 -0700
@@ -26,7 +26,7 @@
  * @bug 4652655 4857717 8025633 8026567
  * @summary This test verifies that class cross references work properly.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
  * @build TestClassCrossReferences
  * @run main TestClassCrossReferences
@@ -34,37 +34,34 @@
 
 public class TestClassCrossReferences extends JavadocTester {
 
-    private static final String[][] TEST = {
-        { "C.html",
-            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/package-summary.html?is-external=true\"><code>Link to math package</code></a>"},
-        { "C.html",
-            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" " +
-            "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>"},
-        { "C.html",
-            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
-                "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
-        { "C.html",
-            "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " +
-                "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
-        { "C.html",
-            "<dl>\n" +
-            "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
-            "<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>\n" +
-            "</dl>"}
-    };
-    private static final String[] ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-            "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/",
-            SRC_DIR, SRC_DIR + "/C.java"};
+    public static void main(String... args) throws Exception {
+        TestClassCrossReferences tester = new TestClassCrossReferences();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestClassCrossReferences tester = new TestClassCrossReferences();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+    @Test
+    void test() {
+        final String uri = "http://java.sun.com/j2se/1.4/docs/api/";
+
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-linkoffline", uri, testSrc,
+                testSrc("C.java"));
+        checkExit(Exit.OK);
+
+        checkOutput("C.html", true,
+                "<a href=\"" + uri + "java/math/package-summary.html?is-external=true\">"
+                + "<code>Link to math package</code></a>",
+                "<a href=\"" + uri + "javax/swing/text/AbstractDocument.AttributeContext.html?is-external=true\" "
+                + "title=\"class or interface in javax.swing.text\"><code>Link to AttributeContext innerclass</code></a>",
+                "<a href=\"" + uri + "java/math/BigDecimal.html?is-external=true\" "
+                + "title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>",
+                "<a href=\"" + uri + "java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" "
+                + "title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>",
+                "<dl>\n"
+                + "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+                + "<dd><code>toString</code>&nbsp;in class&nbsp;<code>java.lang.Object</code></dd>\n"
+                + "</dl>");
     }
+
 }
--- a/test/com/sun/javadoc/testClassTree/TestClassTree.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testClassTree/TestClassTree.java	Fri May 09 15:37:12 2014 -0700
@@ -29,64 +29,52 @@
  *           Make sure class tree includes heirarchy for enums and annotation
  *           types.
  * @author   jamieh
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestClassTree
  * @run main TestClassTree
  */
 
 public class TestClassTree extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestClassTree tester = new TestClassTree();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "pkg/package-tree.html",
-            "<ul>\n" +
-            "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" " +
-            "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>"},
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-        { "pkg/package-tree.html",
-            "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n" +
-            "<ul>\n" +
-            "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" " +
-            "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> " +
-            "(implements java.lang.annotation.Annotation)</li>\n" +
-            "</ul>"},
+        checkOutput("pkg/package-tree.html", true,
+                "<ul>\n"
+                + "<li type=\"circle\">pkg.<a href=\"../pkg/ParentClass.html\" "
+                + "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a>",
+                "<h2 title=\"Annotation Type Hierarchy\">Annotation Type Hierarchy</h2>\n"
+                + "<ul>\n"
+                + "<li type=\"circle\">pkg.<a href=\"../pkg/AnnotationType.html\" "
+                + "title=\"annotation in pkg\"><span class=\"typeNameLink\">AnnotationType</span></a> "
+                + "(implements java.lang.annotation.Annotation)</li>\n"
+                + "</ul>",
+                "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n"
+                + "<ul>\n"
+                + "<li type=\"circle\">java.lang.Object\n"
+                + "<ul>\n"
+                + "<li type=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang."
+                + "Comparable&lt;T&gt;, java.io.Serializable)\n"
+                + "<ul>\n"
+                + "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" "
+                + "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n"
+                + "</ul>\n"
+                + "</li>\n"
+                + "</ul>\n"
+                + "</li>\n"
+                + "</ul>");
 
-        { "pkg/package-tree.html",
-            "<h2 title=\"Enum Hierarchy\">Enum Hierarchy</h2>\n" +
-            "<ul>\n" +
-            "<li type=\"circle\">java.lang.Object\n" +
-            "<ul>\n" +
-            "<li type=\"circle\">java.lang.Enum&lt;E&gt; (implements java.lang." +
-            "Comparable&lt;T&gt;, java.io.Serializable)\n" +
-            "<ul>\n" +
-            "<li type=\"circle\">pkg.<a href=\"../pkg/Coin.html\" " +
-            "title=\"enum in pkg\"><span class=\"typeNameLink\">Coin</span></a></li>\n" +
-            "</ul>\n" +
-            "</li>\n" +
-            "</ul>\n" +
-            "</li>\n" +
-            "</ul>"
-        },
-    };
-    private static final String[][] NEGATED_TEST = {
-        { "pkg/package-tree.html",
-            "<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" " +
-            "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>"}
-        };
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestClassTree tester = new TestClassTree();
-        tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("pkg/package-tree.html", false,
+                "<li type=\"circle\">class pkg.<a href=\"../pkg/ParentClass.html\" "
+                + "title=\"class in pkg\"><span class=\"typeNameLink\">ParentClass</span></a></li>");
     }
 }
--- a/test/com/sun/javadoc/testCmndLineClass/TestCmndLineClass.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testCmndLineClass/TestCmndLineClass.java	Fri May 09 15:37:12 2014 -0700
@@ -28,47 +28,44 @@
  * when specifying packages on the command line and specifying individual
  * classes.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestCmndLineClass
  * @run main TestCmndLineClass
  */
 
 public class TestCmndLineClass extends JavadocTester {
 
-    private static final String OUTPUT_DIR1 = "4506980-tmp1";
-    private static final String OUTPUT_DIR2 = "4506980-tmp2";
-    private static final String[] ARGS1 =
-        new String[] {
-            "-d", OUTPUT_DIR1, "-sourcepath", SRC_DIR,
-            "-notimestamp", SRC_DIR + "/C5.java", "pkg1", "pkg2"
-        };
-    private static final String[] ARGS2 =
-        new String[] {
-            "-d", OUTPUT_DIR2, "-sourcepath", SRC_DIR,
-            "-notimestamp", SRC_DIR + "/C5.java",
-            SRC_DIR + "/pkg1/C1.java",
-            SRC_DIR + "/pkg1/C2.java",
-            SRC_DIR + "/pkg2/C3.java",
-            SRC_DIR + "/pkg2/C4.java"
-        };
-    private static final String[] FILES_TO_DIFF = {
-        "C5.html",
-        "pkg1/C1.html",
-        "pkg1/C2.html",
-        "pkg2/C3.html",
-        "pkg2/C4.html"
-    };
+    public static void main(String... args) throws Exception {
+        TestCmndLineClass tester = new TestCmndLineClass();
+        tester.runTests();
+    }
 
+    @Test
+    void test() {
+        String outdir1 = "out-1";
+        String outdir2 = "out-2";
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestCmndLineClass tester = new TestCmndLineClass();
-        tester.run(ARGS1, NO_TEST, NO_TEST);
-        tester.run(ARGS2, NO_TEST, NO_TEST);
-        tester.runDiffs(OUTPUT_DIR1, OUTPUT_DIR2, FILES_TO_DIFF);
+        javadoc("-d", outdir1,
+                "-sourcepath", testSrc,
+                "-notimestamp",
+                testSrc("C5.java"), "pkg1", "pkg2");
+        checkExit(Exit.OK);
+
+        javadoc("-d", outdir2,
+                "-sourcepath", testSrc,
+                "-notimestamp",
+                testSrc("C5.java"),
+                testSrc("pkg1/C1.java"),
+                testSrc("pkg1/C2.java"),
+                testSrc("pkg2/C3.java"),
+                testSrc("pkg2/C4.java"));
+        checkExit(Exit.OK);
+
+        diff(outdir1, outdir2,
+                "C5.html",
+                "pkg1/C1.html",
+                "pkg1/C2.html",
+                "pkg2/C3.html",
+                "pkg2/C4.html");
     }
 }
--- a/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java	Fri May 09 15:37:12 2014 -0700
@@ -26,32 +26,28 @@
  * @bug 8027977
  * @summary Test to verify javadoc executes without CompletionFailure exception.
  * @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestCompletionFailure
+ * @library ../lib
+ * @build JavadocTester
  * @run main TestCompletionFailure
  */
 
 public class TestCompletionFailure extends JavadocTester {
 
-    //Input for string search tests.
-    private static final String[][] NEGATED_TEST = {
-        {ERROR_OUTPUT, "TestCompletionFailure: error - " +
-            "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for " +
-            "sun.util.locale.provider.LocaleProviderAdapter not found"
-        }
-    };
+    public static void main(String... args) throws Exception {
+        TestCompletionFailure tester = new TestCompletionFailure();
+        tester.runTests();
+    }
 
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg1");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) throws Exception {
-        TestCompletionFailure tester = new TestCompletionFailure();
-        tester.run(ARGS, NO_TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput(Output.STDERR, false,
+                "TestCompletionFailure: error - "
+                + "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for "
+                + "sun.util.locale.provider.LocaleProviderAdapter not found");
     }
 }
--- a/test/com/sun/javadoc/testConstantValuesPage/TestConstantValuesPage.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testConstantValuesPage/TestConstantValuesPage.java	Fri May 09 15:37:12 2014 -0700
@@ -27,28 +27,26 @@
  * @summary Test to make sure that constant values page does not get
  * generated when doclet has nothing to document.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestConstantValuesPage
  * @run main TestConstantValuesPage
  */
 
 public class TestConstantValuesPage extends JavadocTester {
 
-    private static final String[][] NEGATED_TEST = {
-        {NOTICE_OUTPUT, "constant-values.html..."}
-        };
-    private static final String[] ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "foo"};
+    public static void main(String... args) throws Exception {
+        TestConstantValuesPage tester = new TestConstantValuesPage();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestConstantValuesPage tester = new TestConstantValuesPage();
-        tester.run(ARGS, NO_TEST, NEGATED_TEST);
-        tester.printSummary();
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "foo");
+        checkExit(Exit.FAILED);
+
+        checkOutput(Output.NOTICE, false,
+                "constant-values.html...");
     }
 }
--- a/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java	Fri May 09 15:37:12 2014 -0700
@@ -27,37 +27,31 @@
  * @summary  The constructor comments should be surrounded by
  *           <dl></dl>.  Check for this in the output.
  * @author   jamieh
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestConstructorIndent
  * @run main TestConstructorIndent
  */
 
 public class TestConstructorIndent extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
-    };
+    public static void main(String... args) throws Exception {
+        TestConstructorIndent tester = new TestConstructorIndent();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "C.html", "<div class=\"block\">" +
-                 "This is just a simple constructor.</div>\n" +
-                 "<dl>\n" +
-                 "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
-                 "<dd><code>i</code> - a param.</dd>\n" +
-                 "</dl>"
-        }
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                testSrc("C.java"));
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestConstructorIndent tester = new TestConstructorIndent();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("C.html", true,
+                "<div class=\"block\">"
+                + "This is just a simple constructor.</div>\n"
+                + "<dl>\n"
+                + "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+                + "<dd><code>i</code> - a param.</dd>\n"
+                + "</dl>");
     }
 }
--- a/test/com/sun/javadoc/testConstructors/TestConstructors.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testConstructors/TestConstructors.java	Fri May 09 15:37:12 2014 -0700
@@ -26,106 +26,66 @@
  * @bug 8025524 8031625
  * @summary Test for constructor name which should be a non-qualified name.
  * @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestConstructors
+ * @library ../lib
+ * @build JavadocTester
  * @run main TestConstructors
  */
 
 public class TestConstructors extends JavadocTester {
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "pkg1/Outer.html",
-            "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-            "<dd><a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n" +
-            "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\"><code>Inner(int)</code></a>, \n" +
-            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\"><code>NestedInner()</code></a>, \n" +
-            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>NestedInner(int)</code></a>, \n" +
-            "<a href=\"../pkg1/Outer.html#Outer--\"><code>Outer()</code></a>, \n" +
-            "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>"
-        },
-        { "pkg1/Outer.html",
-            "Link: <a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, " +
-            "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, " +
-            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>" +
-            "NestedInner(int)</code></a>"
-        },
-        { "pkg1/Outer.html",
-            "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()"
-        },
-        { "pkg1/Outer.html",
-            "<a name=\"Outer--\">"
-        },
-        { "pkg1/Outer.html",
-            "<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int&nbsp;i)"
-        },
-        { "pkg1/Outer.html",
-            "<a name=\"Outer-int-\">"
-        },
-        { "pkg1/Outer.Inner.html",
-            "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()"
-        },
-        { "pkg1/Outer.Inner.html",
-            "<a name=\"Inner--\">"
-        },
-        { "pkg1/Outer.Inner.html",
-            "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int&nbsp;i)"
-        },
-        { "pkg1/Outer.Inner.html",
-            "<a name=\"Inner-int-\">"
-        },
-        { "pkg1/Outer.Inner.NestedInner.html",
-            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()"
-        },
-        { "pkg1/Outer.Inner.NestedInner.html",
-            "<a name=\"NestedInner--\">"
-        },
-        { "pkg1/Outer.Inner.NestedInner.html",
-            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int&nbsp;i)"
-        },
-        { "pkg1/Outer.Inner.NestedInner.html",
-            "<a name=\"NestedInner-int-\">"
-        }
-    };
+    public static void main(String... args) throws Exception {
+        TestConstructors tester = new TestConstructors();
+        tester.runTests();
+    }
 
-    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",
-            "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner--\"><code>Outer.Inner()</code></a>"
-        },
-        { "pkg1/Outer.html",
-            "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner-int-\"><code>Outer.Inner(int)</code></a>"
-        },
-        { "pkg1/Outer.html",
-            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner--\"><code>Outer.Inner.NestedInner()</code></a>"
-        },
-        { "pkg1/Outer.html",
-            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner-int-\"><code>Outer.Inner.NestedInner(int)</code></a>"
-        }
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg1");
+        checkExit(Exit.OK);
 
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
-    };
+        checkOutput("pkg1/Outer.html", true,
+                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, \n"
+                + "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\"><code>Inner(int)</code></a>, \n"
+                + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\"><code>NestedInner()</code></a>, \n"
+                + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>NestedInner(int)</code></a>, \n"
+                + "<a href=\"../pkg1/Outer.html#Outer--\"><code>Outer()</code></a>, \n"
+                + "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>",
+                "Link: <a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, "
+                + "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, "
+                + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>"
+                + "NestedInner(int)</code></a>",
+                "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()",
+                "<a name=\"Outer--\">",
+                "<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int&nbsp;i)",
+                "<a name=\"Outer-int-\">");
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) throws Exception {
-        TestConstructors tester = new TestConstructors();
-        tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("pkg1/Outer.Inner.html", true,
+                "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()",
+                "<a name=\"Inner--\">",
+                "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int&nbsp;i)",
+                "<a name=\"Inner-int-\">");
+
+        checkOutput("pkg1/Outer.Inner.NestedInner.html", true,
+                "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()",
+                "<a name=\"NestedInner--\">",
+                "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int&nbsp;i)",
+                "<a name=\"NestedInner-int-\">");
+
+        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,
+                "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner--\"><code>Outer.Inner()</code></a>",
+                "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner-int-\"><code>Outer.Inner(int)</code></a>",
+                "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner--\"><code>Outer.Inner.NestedInner()</code></a>",
+                "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner-int-\"><code>Outer.Inner.NestedInner(int)</code></a>");
     }
 }
--- a/test/com/sun/javadoc/testCustomTag/TestCustomTag.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testCustomTag/TestCustomTag.java	Fri May 09 15:37:12 2014 -0700
@@ -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"
-    };
+    public static void main(String... args) throws Exception {
+        TestCustomTag tester = new TestCustomTag();
+        tester.runTests();
+    }
 
-    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"
-    };
+    @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);
 
-    private static final String[] ARGS3 = new String[] {
-        "-d", OUTPUT_DIR + "-3", "-sourcepath",
-        SRC_DIR, SRC_DIR + "/TagTestClass.java"
-    };
+        checkOutput(Output.WARNING, true,
+                "warning - @unknownTag is an unknown tag.");
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = new String[][] {
-        {WARNING_OUTPUT, "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);
 
-    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."
-        }
-    };
+        checkOutput(Output.ERROR, true,
+                "error: unknown tag: unknownTag");
+    }
 
-    private static final String[][] TEST3 = new String[][] {
-        {ERROR_OUTPUT, "error: unknown tag: customTag"
-        },
-        {ERROR_OUTPUT, "error: unknown tag: unknownTag"
-        }
-    };
+    @Test
+    void test3() {
+        javadoc("-Xdoclint:none",
+                "-d", "out-3",
+                "-sourcepath", testSrc,
+                testSrc("TagTestClass.java"));
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        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();
+        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");
     }
 }
--- a/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Fri May 09 15:37:12 2014 -0700
@@ -26,76 +26,65 @@
  * @bug      4927552 8026567
  * @summary  <DESC>
  * @author   jamieh
- * @library  ../lib/
- * @build    JavadocTester TestDeprecatedDocs
+ * @library  ../lib
+ * @build    JavadocTester
  * @run main TestDeprecatedDocs
  */
 
 public class TestDeprecatedDocs extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestDeprecatedDocs tester = new TestDeprecatedDocs();
+        tester.runTests();
+    }
 
-    private static final String TARGET_FILE  =
-        "deprecated-list.html";
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-    private static final String TARGET_FILE2  =
-        "pkg/DeprecatedClassByAnnotation.html";
+        checkOutput("deprecated-list.html", true,
+                "annotation_test1 passes",
+                "annotation_test2 passes",
+                "annotation_test3 passes",
+                "class_test1 passes",
+                "class_test2 passes",
+                "class_test3 passes",
+                "class_test4 passes",
+                "enum_test1 passes",
+                "enum_test2 passes",
+                "error_test1 passes",
+                "error_test2 passes",
+                "error_test3 passes",
+                "error_test4 passes",
+                "exception_test1 passes",
+                "exception_test2 passes",
+                "exception_test3 passes",
+                "exception_test4 passes",
+                "interface_test1 passes",
+                "interface_test2 passes",
+                "interface_test3 passes",
+                "interface_test4 passes",
+                "pkg.DeprecatedClassByAnnotation",
+                "pkg.DeprecatedClassByAnnotation()",
+                "pkg.DeprecatedClassByAnnotation.method()",
+                "pkg.DeprecatedClassByAnnotation.field"
+        );
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        {TARGET_FILE, "annotation_test1 passes"},
-        {TARGET_FILE, "annotation_test2 passes"},
-        {TARGET_FILE, "annotation_test3 passes"},
-        {TARGET_FILE, "class_test1 passes"},
-        {TARGET_FILE, "class_test2 passes"},
-        {TARGET_FILE, "class_test3 passes"},
-        {TARGET_FILE, "class_test4 passes"},
-        {TARGET_FILE, "enum_test1 passes"},
-        {TARGET_FILE, "enum_test2 passes"},
-        {TARGET_FILE, "error_test1 passes"},
-        {TARGET_FILE, "error_test2 passes"},
-        {TARGET_FILE, "error_test3 passes"},
-        {TARGET_FILE, "error_test4 passes"},
-        {TARGET_FILE, "exception_test1 passes"},
-        {TARGET_FILE, "exception_test2 passes"},
-        {TARGET_FILE, "exception_test3 passes"},
-        {TARGET_FILE, "exception_test4 passes"},
-        {TARGET_FILE, "interface_test1 passes"},
-        {TARGET_FILE, "interface_test2 passes"},
-        {TARGET_FILE, "interface_test3 passes"},
-        {TARGET_FILE, "interface_test4 passes"},
-        {TARGET_FILE, "pkg.DeprecatedClassByAnnotation"},
-        {TARGET_FILE, "pkg.DeprecatedClassByAnnotation()"},
-        {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.method()"},
-        {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
-
-        {TARGET_FILE2, "<pre>@Deprecated\n" +
-                 "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n" +
-                 "extends java.lang.Object</pre>"},
-
-        {TARGET_FILE2, "<pre>@Deprecated\n" +
-                 "public&nbsp;int field</pre>\n" +
-                 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
-
-        {TARGET_FILE2, "<pre>@Deprecated\n" +
-                 "public&nbsp;DeprecatedClassByAnnotation()</pre>\n" +
-                 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
-
-        {TARGET_FILE2, "<pre>@Deprecated\n" +
-                 "public&nbsp;void&nbsp;method()</pre>\n" +
-                 "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>"},
-    };
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestDeprecatedDocs tester = new TestDeprecatedDocs();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("pkg/DeprecatedClassByAnnotation.html", true,
+                "<pre>@Deprecated\n"
+                + "public class <span class=\"typeNameLabel\">DeprecatedClassByAnnotation</span>\n"
+                + "extends java.lang.Object</pre>",
+                "<pre>@Deprecated\n"
+                + "public&nbsp;int field</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>",
+                "<pre>@Deprecated\n"
+                + "public&nbsp;DeprecatedClassByAnnotation()</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>",
+                "<pre>@Deprecated\n"
+                + "public&nbsp;void&nbsp;method()</pre>\n"
+                + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span>&nbsp;</div>");
     }
 }
--- a/test/com/sun/javadoc/testDocEncoding/TestDocEncoding.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDocEncoding/TestDocEncoding.java	Fri May 09 15:37:12 2014 -0700
@@ -31,36 +31,30 @@
  * @summary  Run tests on -docencoding to see if the value is
              used for stylesheet as well.
  * @author   jayashree viswanathan
- * @library  ../lib/
- * @build    JavadocTester TestDocEncoding
+ * @library  ../lib
+ * @build    JavadocTester
  * @run main TestDocEncoding
  */
 
 public class TestDocEncoding extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR,
-        "-docencoding", "Cp930",
-        "-sourcepath", SRC_DIR,
-        "-notimestamp",
-        "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestDocEncoding tester = new TestDocEncoding();
+        tester.runTests();
+    }
 
-    private static final String[][] NEGATED_TEST = {
-        { "stylesheet.css",
-            "body {\n" +
-            "    background-color:#ffffff;"}
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-docencoding", "Cp930",
+                "-sourcepath", testSrc,
+                "-notimestamp",
+                "pkg");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestDocEncoding tester = new TestDocEncoding();
-        tester.run(ARGS, NO_TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("stylesheet.css", false,
+                "body {\n"
+                + "    background-color:#ffffff;");
     }
 }
 
--- a/test/com/sun/javadoc/testDocErrorReporter/TestDocErrorReporter.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDocErrorReporter/TestDocErrorReporter.java	Fri May 09 15:37:12 2014 -0700
@@ -27,31 +27,30 @@
  * @summary  Make sure that option validation errors and sent to the
  *           DocErrorReporter.
  * @author   jamieh
- * @library  ../lib/
+ * @library ../lib
  * @build    JavadocTester
- * @build    TestDocErrorReporter
  * @run main TestDocErrorReporter
  */
 
 public class TestDocErrorReporter extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-encoding", "xyz",
-            SRC_DIR + "/TestDocErrorReporter.java"
-    };
-
-    //Input for Javadoc return code test.
-    private static final int EXPECTED_EXIT_CODE = 1;
-
     /**
      * The entry point of the test.
-     * @param args the array of command line arguments.
+     * @param args the array of command line arguments
+     * @throws Exception if the test fails
      */
-    public static void main(String[] args) {
+    public static void main(String... args) throws Exception {
         TestDocErrorReporter tester = new TestDocErrorReporter();
-        int actualExitCode = tester.run(ARGS, NO_TEST, NO_TEST);
-        tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
-        tester.printSummary();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-encoding", "xyz",
+                testSrc("TestDocErrorReporter.java"));
+
+        checkExit(Exit.FAILED);
     }
 }
--- a/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java	Fri May 09 15:37:12 2014 -0700
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import java.io.File;
-
 /*
  * @test
  * @bug 4258405 4973606 8024096
@@ -31,68 +29,59 @@
  *          directory.
  *          Also test that -docfilessubdirs and -excludedocfilessubdir both work.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestDocFileDir
  * @run main TestDocFileDir
  */
 
 public class TestDocFileDir extends JavadocTester {
 
-    private static final String[][] TEST1 = {
-        { "pkg/doc-files/testfile.txt",
-            "This doc file did not get trashed."}
-        };
+    public static void main(String... args) throws Exception {
+        TestDocFileDir tester = new TestDocFileDir();
+        tester.runTests();
+    }
 
-    private static final String[] FILE_TEST2 = {
-        "pkg/doc-files/subdir-used1/testfile.txt",
-        "pkg/doc-files/subdir-used2/testfile.txt"
-    };
-    private static final String[] FILE_NEGATED_TEST2 = {
-        "pkg/doc-files/subdir-excluded1/testfile.txt",
-        "pkg/doc-files/subdir-excluded2/testfile.txt"
-    };
+    // Output dir = "", Input dir = ""
+    @Test
+    void test1() {
+        copyDir(testSrc("pkg"), ".");
+        setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
+        javadoc("pkg/C.java");
+        checkExit(Exit.OK);
+        checkOutput("pkg/doc-files/testfile.txt", true,
+            "This doc file did not get trashed.");
+    }
 
-    private static final String[][] TEST0 = {
-        {"pkg/doc-files/testfile.txt",
-            "This doc file did not get trashed."}
-        };
+    // Output dir = Input Dir
+    @Test
+    void test2() {
+        String outdir = "out2";
+        copyDir(testSrc("pkg"), outdir);
+        setOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
+        javadoc("-d", outdir,
+            "-sourcepath", "blah" + PS + outdir + PS + "blah",
+            "pkg");
+        checkExit(Exit.OK);
+        checkOutput("pkg/doc-files/testfile.txt", true,
+            "This doc file did not get trashed.");
+    }
 
-    //Output dir = Input Dir
-    private static final String[] ARGS1 =
-        new String[] {
-            "-d", OUTPUT_DIR + "-1",
-            "-sourcepath",
-            "blah" + File.pathSeparator + OUTPUT_DIR + "-1" +
-            File.pathSeparator + "blah", "pkg"};
-
-    //Exercising -docfilessubdirs and -excludedocfilessubdir
-    private static final String[] ARGS2 =
-        new String[] {
-            "-d", OUTPUT_DIR + "-2",
-            "-sourcepath", SRC_DIR,
-            "-docfilessubdirs",
-            "-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2",
-            "pkg"};
-
-    //Output dir = "", Input dir = ""
-    private static final String[] ARGS0 =
-        new String[] {"pkg/C.java"};
-
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestDocFileDir tester = new TestDocFileDir();
-        tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
-        copyDir(SRC_DIR + "/pkg", ".");
-        tester.run(ARGS0, TEST0, NO_TEST);
-        copyDir(SRC_DIR + "/pkg", OUTPUT_DIR + "-1");
-        tester.run(ARGS1, TEST1, NO_TEST);
-        tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
-        tester.run(ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2);
-        tester.printSummary();
+    // Exercising -docfilessubdirs and -excludedocfilessubdir
+    @Test
+    void test3() {
+        String outdir = "out3";
+        setOutputDirectoryCheck(DirectoryCheck.NONE);
+        javadoc("-d", outdir,
+                "-sourcepath", testSrc,
+                "-docfilessubdirs",
+                "-excludedocfilessubdir", "subdir-excluded1:subdir-excluded2",
+                "pkg");
+        checkExit(Exit.OK);
+        checkFiles(true,
+                "pkg/doc-files/subdir-used1/testfile.txt",
+                "pkg/doc-files/subdir-used2/testfile.txt");
+        checkFiles(false,
+                "pkg/doc-files/subdir-excluded1/testfile.txt",
+                "pkg/doc-files/subdir-excluded2/testfile.txt");
     }
 }
--- a/test/com/sun/javadoc/testDocFiles/TestDocFiles.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDocFiles/TestDocFiles.java	Fri May 09 15:37:12 2014 -0700
@@ -25,28 +25,26 @@
  * @test
  * @bug 8008949
  * @summary verify that doc-files get copied
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestDocFiles
  * @run main TestDocFiles
  */
 
 public class TestDocFiles extends JavadocTester {
 
-    private static final String[][] TEST = {
-        { "pkg/doc-files/test.txt", "test file"}};
+    public static void main(String... args) throws Exception {
+        TestDocFiles tester = new TestDocFiles();
+        tester.runTests();
+    }
 
-    private static final String[] ARGS =
-        new String[] {
-            "-d", "tmp", "-sourcepath", SRC_DIR, "pkg"};
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestDocFiles tester = new TestDocFiles();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("pkg/doc-files/test.txt", true,
+                "test file");
     }
 }
--- a/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDocRootInlineTag/TestDocRootInlineTag.java	Fri May 09 15:37:12 2014 -0700
@@ -28,42 +28,38 @@
  * If docRoot performs as documented, the test passes.
  * Make sure that the docRoot tag works with the -bottom option.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestDocRootInlineTag
  * @run main TestDocRootInlineTag
  */
 
 public class TestDocRootInlineTag extends JavadocTester {
 
-    private static final String[][] TEST = {
-        { "TestDocRootTag.html",
-            "<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
-            "title=\"class or interface in java.io\"><code>File</code></a>"},
-        { "TestDocRootTag.html",
-            "<a href=\"./glossary.html\">glossary</a>"},
-        { "TestDocRootTag.html",
-            "<a href=\"http://www.java.sun.com/j2se/1.4/docs/api/java/io/File.html?is-external=true\" " +
-            "title=\"class or interface in java.io\"><code>Second File Link</code></a>"},
-        { "TestDocRootTag.html", "The value of @docRoot is \"./\""},
-        { "index-all.html", "My package page is " +
-            "<a href=\"./pkg/package-summary.html\">here</a>"}
-    };
-    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"
-        };
+    public static void main(String... args) throws Exception {
+        TestDocRootInlineTag tester = new TestDocRootInlineTag();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestDocRootInlineTag tester = new TestDocRootInlineTag();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+    @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,
+                "<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
+                + "title=\"class or interface in java.io\"><code>File</code></a>",
+                "<a href=\"./glossary.html\">glossary</a>",
+                "<a href=\"" + uri + "/java/io/File.html?is-external=true\" "
+                + "title=\"class or interface in java.io\"><code>Second File Link</code></a>",
+                "The value of @docRoot is \"./\"");
+
+        checkOutput("index-all.html", true,
+                "My package page is <a href=\"./pkg/package-summary.html\">here</a>");
     }
 }
--- a/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDocRootLink/TestDocRootLink.java	Fri May 09 15:37:12 2014 -0700
@@ -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 <a href=\"../../technotes/guides/index.html\">Here</a>"
-        },
-        { "pkg1/C1.html",
+    public static void main(String... args) throws Exception {
+        TestDocRootLink tester = new TestDocRootLink();
+        tester.runTests();
+    }
+
+    @Test
+    void test1() {
+        javadoc("-d", "out-1",
+                "-sourcepath", testSrc,
+                "pkg1", "pkg2");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg1/C1.html", true,
+            "Refer <a href=\"../../technotes/guides/index.html\">Here</a>",
             "This <a href=\"../pkg2/C2.html\">Here</a> should not be replaced\n" +
-            " with an absolute link."
-        },
-        { "pkg1/C1.html",
+            " with an absolute link.",
             "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
-            " <a href=\"../pkg2/C2.html\">Link 2</a>."
-        },
-        { "pkg1/package-summary.html",
+            " <a href=\"../pkg2/C2.html\">Link 2</a>.");
+
+        checkOutput("pkg1/package-summary.html", true,
             "<a href=\"../../technotes/guides/index.html\">\n" +
-            "            Test document 1</a>"
-        },
-        { "pkg1/package-summary.html",
+            "            Test document 1</a>",
             "<a href=\"../pkg2/C2.html\">\n" +
-            "            Another Test document 1</a>"
-        },
-        { "pkg1/package-summary.html",
+            "            Another Test document 1</a>",
             "<a href=\"../technotes/guides/index.html\">\n" +
-            "            Another Test document 2.</a>"
-        }
-    };
-    private static final String[][] NEGATED_TEST1 = {
-        { "pkg1/C1.html",
-            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
-        },
-        { "pkg1/C1.html",
-            "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
-        },
-        { "pkg1/package-summary.html",
-            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">"
-        },
-        { "pkg1/package-summary.html",
-            "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">"
-        }
-    };
-    private static final String[][] TEST2 = {
-        { "pkg2/C2.html",
-            "Refer <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>"
-        },
-        { "pkg2/C2.html",
+            "            Another Test document 2.</a>");
+
+        // TODO: should this check *any* reference to http://download.oracle.com/
+        checkOutput("pkg1/C1.html", false,
+            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
+            "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
+
+        checkOutput("pkg1/package-summary.html", false,
+            "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">",
+            "<a href=\"http://download.oracle.com/javase/7/docs/pkg2/C2.html\">");
+    }
+
+    @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 <a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">Here</a>",
             "This <a href=\"../pkg1/C1.html\">Here</a> should not be replaced\n" +
-            " with an absolute link."
-        },
-        { "pkg2/C2.html",
+            " with an absolute link.",
             "Testing <a href=\"../technotes/guides/index.html\">Link 1</a> and\n" +
-            " <a href=\"../pkg1/C1.html\">Link 2</a>."
-        },
-        { "pkg2/package-summary.html",
+            " <a href=\"../pkg1/C1.html\">Link 2</a>.");
+
+        checkOutput("pkg2/package-summary.html", true,
             "<a href=\"http://download.oracle.com/javase/7/docs/technotes/guides/index.html\">\n" +
-            "            Test document 1</a>"
-        },
-        { "pkg2/package-summary.html",
+            "            Test document 1</a>",
             "<a href=\"../pkg1/C1.html\">\n" +
-            "            Another Test document 1</a>"
-        },
-        { "pkg2/package-summary.html",
+            "            Another Test document 1</a>",
             "<a href=\"../technotes/guides/index.html\">\n" +
-            "            Another Test document 2.</a>"
-        }
-    };
-    private static final String[][] NEGATED_TEST2 = {
-        { "pkg2/C2.html",
-            "<a href=\"../../technotes/guides/index.html\">"
-        },
-        { "pkg2/C2.html",
-            "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">"
-        },
-        { "pkg2/package-summary.html",
-            "<a href=\"../../technotes/guides/index.html\">"
-        },
-        { "pkg2/package-summary.html",
-            "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.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"
-    };
+            "            Another Test document 2.</a>");
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestDocRootLink tester = new TestDocRootLink();
-        tester.run(ARGS1, TEST1, NEGATED_TEST1);
-        tester.run(ARGS2, TEST2, NEGATED_TEST2);
-        tester.printSummary();
+        checkOutput("pkg2/C2.html", false,
+            "<a href=\"../../technotes/guides/index.html\">",
+            "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
+
+        checkOutput("pkg2/package-summary.html", false,
+            "<a href=\"../../technotes/guides/index.html\">",
+            "<a href=\"http://download.oracle.com/javase/7/docs/pkg1/C1.html\">");
     }
 }
--- a/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testDupParamWarn/TestDupParamWarn.java	Fri May 09 15:37:12 2014 -0700
@@ -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."}};
+    public static void main(String... args) throws Exception {
+        JavadocTester tester = new TestDupParamWarn();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        JavadocTester tester = new TestDupParamWarn();
-        tester.run(ARGS, NO_TEST, NEGATED_TEST);
-        tester.printSummary();
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
+
+        checkOutput(Output.WARNING, false,
+            "Parameter \"a\" is documented more than once.");
     }
 }
--- a/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testEmptyClass/TestEmptyClass.java	Fri May 09 15:37:12 2014 -0700
@@ -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", "<A HREF=\"TestEmptyClass.html\">"},
+        checkOutput("overview-tree.html", false,
+                "<A HREF=\"TestEmptyClass.html\">");
 
         //The index page should not link to classes that were not documented
-        { "index-all.html", "<A HREF=\"TestEmptyClass.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,
+                "<A HREF=\"TestEmptyClass.html\">");
     }
 }
--- a/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testEnclosingClass/TestEnclosingClass.java	Fri May 09 15:37:12 2014 -0700
@@ -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"
-    };
+    public static void main(String... args) throws Exception {
+        TestEnclosingClass tester = new TestEnclosingClass();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        { "pkg/MyClass.MyInterface.html", "Enclosing class:"}
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestEnclosingClass tester = new TestEnclosingClass();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("pkg/MyClass.MyInterface.html", true,
+                "Enclosing class:");
     }
 }
--- a/test/com/sun/javadoc/testEncoding/TestEncoding.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testEncoding/TestEncoding.java	Fri May 09 15:37:12 2014 -0700
@@ -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 {
 
+    public static void main(String... args) throws Exception {
+        TestEncoding tester = new TestEncoding();
+        tester.runTests();
+    }
 
-    //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"
-        };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-encoding", "iso-8859-1",
+                testSrc("EncodeTest.java"));
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestEncoding tester = new TestEncoding();
-        tester.run(ARGS, NO_TEST, NEGATED_TEST);
-        tester.printSummary();
+        // If ??? is found in the output, the source file was not read with the correct encoding setting.
+        checkOutput("EncodeTest.html", false,
+                "??");
     }
 }
--- a/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java	Fri May 09 15:37:12 2014 -0700
@@ -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",
-            "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n" +
-            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " +
-            "title=\"class or interface in java.io\">read</a></code>&nbsp;in class&nbsp;<code>" +
-            "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
-            "title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
-        { "pkg/XReader.html",
-            "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n" +
-            "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " +
-            "title=\"class or interface in java.io\">readInt</a></code>&nbsp;in interface&nbsp;<code>" +
-            "<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
-            "title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
+    public static void main(String... args) throws Exception {
+        TestExternalOverridenMethod tester = new TestExternalOverridenMethod();
+        tester.runTests();
+    }
 
-    private static final String[] ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-            "-linkoffline", "http://java.sun.com/j2se/1.4.1/docs/api", SRC_DIR,
-            "pkg"
-        };
+    @Test
+    void test() {
+        String uri = "http://java.sun.com/j2se/1.4.1/docs/api";
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-linkoffline", uri, testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestExternalOverridenMethod tester = new TestExternalOverridenMethod();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("pkg/XReader.html", true,
+                "<dt><span class=\"overrideSpecifyLabel\">Overrides:</span></dt>\n"
+                + "<dd><code><a href=\"" + uri + "/java/io/FilterReader.html?is-external=true#read--\" "
+                + "title=\"class or interface in java.io\">read</a></code>&nbsp;in class&nbsp;<code>"
+                + "<a href=\"" + uri + "/java/io/FilterReader.html?is-external=true\" "
+                + "title=\"class or interface in java.io\">FilterReader</a></code></dd>",
+                "<dt><span class=\"overrideSpecifyLabel\">Specified by:</span></dt>\n"
+                + "<dd><code><a href=\"" + uri + "/java/io/DataInput.html?is-external=true#readInt--\" "
+                + "title=\"class or interface in java.io\">readInt</a></code>&nbsp;in interface&nbsp;<code>"
+                + "<a href=\"" + uri + "/java/io/DataInput.html?is-external=true\" "
+                + "title=\"class or interface in java.io\">DataInput</a></code></dd>"
+        );
     }
 }
--- a/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java	Fri May 09 15:37:12 2014 -0700
@@ -25,14 +25,41 @@
  * @test
  * @bug 8000418 8024288
  * @summary Verify that files use a common Generated By string
- * @library ../lib/
- * @build JavadocTester TestGeneratedBy
+ * @library ../lib
+ * @build JavadocTester
  * @run main TestGeneratedBy
  */
 
 public class TestGeneratedBy extends JavadocTester {
 
-    private static final String[] FILES = {
+    public static void main(String... args) throws Exception {
+        TestGeneratedBy tester = new TestGeneratedBy();
+        tester.runTests();
+    }
+
+    @Test
+    void testTimestamp() {
+        javadoc("-d", "out-timestamp",
+            "-sourcepath", testSrc,
+            "pkg");
+        checkExit(Exit.OK);
+
+        checkTimestamps(true);
+    }
+
+    @Test
+    void testNoTimestamp() {
+        javadoc("-d", "out-notimestamp",
+            "-notimestamp",
+            "-sourcepath", testSrc,
+            "pkg");
+        checkExit(Exit.OK);
+
+        checkTimestamps(false);
+    }
+
+    void checkTimestamps(boolean timestamp) {
+        checkTimestamps(timestamp,
         "pkg/MyClass.html",
         "pkg/package-summary.html",
         "pkg/package-frame.html",
@@ -45,63 +72,25 @@
         "serialized-form.html",
         "help-doc.html",
         "index-all.html",
-        "index.html"
-    };
+        "index.html");
 
-    private static final String[] STD_ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR,
-            "-sourcepath", SRC_DIR,
-            "pkg"
-        };
-
-    private static final String[] NO_TIMESTAMP_ARGS =
-        new String[] {
-            "-notimestamp",
-            "-d", OUTPUT_DIR + "-1",
-            "-sourcepath", SRC_DIR,
-            "pkg"
-        };
-
-
-    private static String[][] getTests(boolean timestamp) {
-        String version = System.getProperty("java.version");
-        String[][] tests = new String[FILES.length][];
-        for (int i = 0; i < FILES.length; i++) {
-            String genBy = "Generated by javadoc";
-            if (timestamp) genBy += " (" + version + ") on ";
-            tests[i] = new String[] {
-                FILES[i], genBy
-            };
-        }
-        return tests;
     }
 
-    private static String[][] getNegatedTests(boolean timestamp) {
-        String[][] tests = new String[FILES.length][];
-        for (int i = 0; i < FILES.length; i++) {
-            tests[i] = new String[] {
-                FILES[i],
+    void checkTimestamps(boolean timestamp, String... files) {
+        String version = System.getProperty("java.version");
+        String genBy = "Generated by javadoc";
+        if (timestamp) genBy += " (" + version + ") on ";
+
+        for (String file: files) {
+            // genBy is the current standard "Generated by" text
+            checkOutput(file, true, genBy);
+
+            // These are older versions of the "Generated by" text
+            checkOutput(file, false,
                 (timestamp
                     ? "Generated by javadoc (version"
                     : "Generated by javadoc ("),
-                "Generated by javadoc on"
-            };
-        }
-        return tests;
-    }
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestGeneratedBy tester = new TestGeneratedBy();
-        int ec1 = tester.run(STD_ARGS, getTests(true), getNegatedTests(true));
-        int ec2 = tester.run(NO_TIMESTAMP_ARGS, getTests(false), getNegatedTests(false));
-        tester.printSummary();
-        if (ec1 != 0 || ec2 != 0) {
-            throw new Error("Error found while executing Javadoc");
+                "Generated by javadoc on");
         }
     }
 }
--- a/test/com/sun/javadoc/testGroupOption/TestGroupOption.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testGroupOption/TestGroupOption.java	Fri May 09 15:37:12 2014 -0700
@@ -27,49 +27,46 @@
  * @summary  Test to make sure the -group option does not cause a bad warning
  *           to be printed.
  * @author   jamieh
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestGroupOption
  * @run main TestGroupOption
  */
 
 public class TestGroupOption extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS1 = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-        "-group", "Package One", "pkg1",
-        "-group", "Package Two", "pkg2",
-        "-group", "Package Three", "pkg3",
-        "pkg1", "pkg2", "pkg3"
-    };
+    public static void main(String... args) throws Exception {
+        TestGroupOption tester = new TestGroupOption();
+        tester.runTests();
+    }
 
-    private static final String[] ARGS2 = new String[] {
-        "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
-        "-group", "Package One", "pkg1",
-        "-group", "Package One", "pkg2",
-        "-group", "Package One", "pkg3",
-        "pkg1", "pkg2", "pkg3"
-    };
+    @Test
+    void test1() {
+        //Make sure the warning is not printed when -group is used correctly.
+        javadoc("-d", "out-1",
+                "-sourcepath", testSrc,
+                "-group", "Package One", "pkg1",
+                "-group", "Package Two", "pkg2",
+                "-group", "Package Three", "pkg3",
+                "pkg1", "pkg2", "pkg3");
+        checkExit(Exit.OK);
 
-    //Input for string search tests.
-    private static final String[][] NEGATED_TEST1 = {{WARNING_OUTPUT, "-group"}};
+        checkOutput(Output.WARNING, false,
+                "-group");
+    }
 
-    private static final String[][] TEST2 = {{WARNING_OUTPUT, "-group"}};
+    @Test
+    void test2() {
+        //Make sure the warning is printed when -group is not used correctly.
+        javadoc("-d", "out-2",
+                "-sourcepath", testSrc,
+                "-group", "Package One", "pkg1",
+                "-group", "Package One", "pkg2",
+                "-group", "Package One", "pkg3",
+                "pkg1", "pkg2", "pkg3");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        //Make sure the warning is not printed when -group is used correctly.
-        TestGroupOption tester = new TestGroupOption();
-        tester.run(ARGS1, NO_TEST, NEGATED_TEST1);
-        tester.printSummary();
+        checkOutput(Output.WARNING, true,
+                "-group");
 
-        //Make sure the warning is printed when -group is not used correctly.
-        tester = new TestGroupOption();
-        tester.run(ARGS2, TEST2, NO_TEST);
-        tester.printSummary();
     }
 }
--- a/test/com/sun/javadoc/testHeadings/TestHeadings.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHeadings/TestHeadings.java	Fri May 09 15:37:12 2014 -0700
@@ -26,7 +26,7 @@
  * @bug      4905786 6259611
  * @summary  Make sure that headings use the TH tag instead of the TD tag.
  * @author   jamieh
- * @library  ../lib/
+ * @library ../lib
  * @build    JavadocTester
  * @build    TestHeadings
  * @run main TestHeadings
@@ -34,87 +34,82 @@
 
 public class TestHeadings extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "-header", "Test Files",
-        "pkg1", "pkg2"
-    };
+    private static final String[][] TEST = {
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        //Package summary
-        { "pkg1/package-summary.html",
-            "<th class=\"colFirst\" scope=\"col\">" +
-            "Class</th>\n" +
-            "<th class=\"colLast\" scope=\"col\"" +
-            ">Description</th>"
+        {
+        },
+        { "serialized-form.html"
+        },
+        { "serialized-form.html"
         },
 
-        // Class documentation
-        { "pkg1/C1.html",
-            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
-            "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
+        {
         },
-        { "pkg1/C1.html",
-            "<h3>Methods inherited from class&nbsp;java.lang.Object</h3>"
+        { "overview-frame.html"
         },
-
-        // Class use documentation
-        { "pkg1/class-use/C1.html",
-            "<th class=\"colFirst\" scope=\"col\">Package</th>\n" +
-            "<th class=\"colLast\" scope=\"col\">Description</th>"
-        },
-        { "pkg1/class-use/C1.html",
-            "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" +
-            "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
-        },
-
-        // Deprecated
-        { "deprecated-list.html",
-            "<th class=\"colOne\" scope=\"col\">Method and Description</th>"
-        },
-
-        // Constant values
-        { "constant-values.html",
-            "<th class=\"colFirst\" scope=\"col\">" +
-            "Modifier and Type</th>\n" +
-            "<th scope=\"col\">Constant Field</th>\n" +
-            "<th class=\"colLast\" scope=\"col\">Value</th>"
-        },
-
-        // Serialized Form
-        { "serialized-form.html",
-            "<h2 title=\"Package\">Package&nbsp;pkg1</h2>"
-        },
-        { "serialized-form.html",
-            "<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
-            "pkg1.C1</a> extends java.lang.Object implements Serializable</h3>"
-        },
-        { "serialized-form.html",
-            "<h3>Serialized Fields</h3>"
-        },
-
-        // Overview Frame
-        { "overview-frame.html",
-            "<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>"
-        },
-        { "overview-frame.html",
-            "<title>Overview List</title>"
-        },
-
-        // Overview Summary
-        { "overview-summary.html",
-            "<title>Overview</title>"
+        {
         }
     };
 
-    /**
-     * 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 {
         TestHeadings tester = new TestHeadings();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-use",
+                "-header", "Test Files",
+                "pkg1", "pkg2");
+        checkExit(Exit.OK);
+
+        //Package summary
+        checkOutput("pkg1/package-summary.html", true,
+                "<th class=\"colFirst\" scope=\"col\">"
+                + "Class</th>\n"
+                + "<th class=\"colLast\" scope=\"col\""
+                + ">Description</th>");
+
+        // Class documentation
+        checkOutput("pkg1/C1.html", true,
+                "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Field and Description</th>",
+                "<h3>Methods inherited from class&nbsp;java.lang.Object</h3>");
+
+        // Class use documentation
+        checkOutput("pkg1/class-use/C1.html", true,
+                "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Description</th>",
+                "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Field and Description</th>");
+
+        // Deprecated
+        checkOutput("deprecated-list.html", true,
+                "<th class=\"colOne\" scope=\"col\">Method and Description</th>");
+
+        // Constant values
+        checkOutput("constant-values.html", true,
+                "<th class=\"colFirst\" scope=\"col\">"
+                + "Modifier and Type</th>\n"
+                + "<th scope=\"col\">Constant Field</th>\n"
+                + "<th class=\"colLast\" scope=\"col\">Value</th>");
+
+        // Serialized Form
+        checkOutput("serialized-form.html", true,
+                "<h2 title=\"Package\">Package&nbsp;pkg1</h2>",
+                "<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">"
+                + "pkg1.C1</a> extends java.lang.Object implements Serializable</h3>",
+                "<h3>Serialized Fields</h3>");
+
+        // Overview Frame
+        checkOutput("overview-frame.html", true,
+                "<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>",
+                "<title>Overview List</title>");
+
+        // Overview Summary
+        checkOutput("overview-summary.html", true,
+                "<title>Overview</title>");
     }
 }
--- a/test/com/sun/javadoc/testHelpFile/TestHelpFile.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHelpFile/TestHelpFile.java	Fri May 09 15:37:12 2014 -0700
@@ -26,32 +26,26 @@
  * @bug      7132631
  * @summary  Make sure that the help file is generated correctly.
  * @author   Bhavesh Patel
- * @library  ../lib/
- * @build    JavadocTester TestHelpFile
+ * @library  ../lib
+ * @build    JavadocTester
  * @run main TestHelpFile
  */
 
 public class TestHelpFile extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-            SRC_DIR + "/TestHelpFile.java"
-    };
+    public static void main(String... args) throws Exception {
+        TestHelpFile tester = new TestHelpFile();
+        tester.runTests();
+    }
 
-    private static final String[][] TEST = {
-        { "help-doc.html",
-            "<a href=\"constant-values.html\">Constant Field Values</a>"
-        },
-    };
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                testSrc("TestHelpFile.java"));
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestHelpFile tester = new TestHelpFile();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+        checkOutput("help-doc.html", true,
+            "<a href=\"constant-values.html\">Constant Field Values</a>");
     }
 }
--- a/test/com/sun/javadoc/testHelpOption/TestHelpOption.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHelpOption/TestHelpOption.java	Fri May 09 15:37:12 2014 -0700
@@ -27,81 +27,79 @@
  * @summary  Make sure that the -help option works properly.  Make sure
  *           the help link appears in the documentation.
  * @author   jamieh
- * @library  ../lib/
+ * @library ../lib
  * @build    JavadocTester TestHelpOption
  * @run main TestHelpOption
  */
 
 public class TestHelpOption extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-help",
-            SRC_DIR + "/TestHelpOption.java"
-    };
+    public static void main(String... args) throws Exception {
+        TestHelpOption tester = new TestHelpOption();
+        tester.runTests();
+    }
 
-    private static final String[] ARGS2 = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-            SRC_DIR + "/TestHelpOption.java"
-    };
+    @Test
+    void testWithOption() {
+        javadoc("-d", "out1",
+                "-sourcepath", testSrc,
+                "-help",
+                testSrc("TestHelpOption.java"));
+        checkExit(Exit.OK);
 
-    private static final String[][] TEST = {
-        {STANDARD_OUTPUT, "-d "},
-        {STANDARD_OUTPUT, "-use "},
-        {STANDARD_OUTPUT, "-version "},
-        {STANDARD_OUTPUT, "-author "},
-        {STANDARD_OUTPUT, "-docfilessubdirs "},
-        {STANDARD_OUTPUT, "-splitindex "},
-        {STANDARD_OUTPUT, "-windowtitle "},
-        {STANDARD_OUTPUT, "-doctitle "},
-        {STANDARD_OUTPUT, "-header "},
-        {STANDARD_OUTPUT, "-footer "},
-        {STANDARD_OUTPUT, "-bottom "},
-        {STANDARD_OUTPUT, "-link "},
-        {STANDARD_OUTPUT, "-linkoffline "},
-        {STANDARD_OUTPUT, "-excludedocfilessubdir "},
-        {STANDARD_OUTPUT, "-group "},
-        {STANDARD_OUTPUT, "-nocomment "},
-        {STANDARD_OUTPUT, "-nodeprecated "},
-        {STANDARD_OUTPUT, "-noqualifier "},
-        {STANDARD_OUTPUT, "-nosince "},
-        {STANDARD_OUTPUT, "-notimestamp "},
-        {STANDARD_OUTPUT, "-nodeprecatedlist "},
-        {STANDARD_OUTPUT, "-notree "},
-        {STANDARD_OUTPUT, "-noindex "},
-        {STANDARD_OUTPUT, "-nohelp "},
-        {STANDARD_OUTPUT, "-nonavbar "},
-        {STANDARD_OUTPUT, "-serialwarn "},
-        {STANDARD_OUTPUT, "-tag "},
-        {STANDARD_OUTPUT, "-taglet "},
-        {STANDARD_OUTPUT, "-tagletpath "},
-        {STANDARD_OUTPUT, "-charset "},
-        {STANDARD_OUTPUT, "-helpfile "},
-        {STANDARD_OUTPUT, "-linksource "},
-        {STANDARD_OUTPUT, "-sourcetab "},
-        {STANDARD_OUTPUT, "-keywords "},
-        {STANDARD_OUTPUT, "-stylesheetfile "},
-        {STANDARD_OUTPUT, "-docencoding "},
-    };
+        checkOutput(true);
+    }
 
-    private static final String[][] TEST2 = {
-        { "TestHelpOption.html",
-            "<li><a href=\"help-doc.html\">Help</a></li>"
-        },
-    };
+    @Test
+    void testWithoutOption() {
+        javadoc("-d", "out2",
+                "-sourcepath", testSrc,
+                testSrc("TestHelpOption.java"));
+        checkExit(Exit.OK);
 
-    //The help option should not crash the doclet.
-    private static final int EXPECTED_EXIT_CODE = 0;
+        checkOutput(false);
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestHelpOption tester = new TestHelpOption();
-        int actualExitCode = tester.run(ARGS, TEST, NO_TEST);
-        tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
-        tester.run(ARGS2, TEST2, NO_TEST);
-        tester.printSummary();
+    private void checkOutput(boolean withOption) {
+        checkOutput(Output.STDOUT, withOption,
+                "-d ",
+                "-use ",
+                "-version ",
+                "-author ",
+                "-docfilessubdirs ",
+                "-splitindex ",
+                "-windowtitle ",
+                "-doctitle ",
+                "-header ",
+                "-footer ",
+                "-bottom ",
+                "-link ",
+                "-linkoffline ",
+                "-excludedocfilessubdir ",
+                "-group ",
+                "-nocomment ",
+                "-nodeprecated ",
+                "-noqualifier ",
+                "-nosince ",
+                "-notimestamp ",
+                "-nodeprecatedlist ",
+                "-notree ",
+                "-noindex ",
+                "-nohelp ",
+                "-nonavbar ",
+                "-serialwarn ",
+                "-tag ",
+                "-taglet ",
+                "-tagletpath ",
+                "-charset ",
+                "-helpfile ",
+                "-linksource ",
+                "-sourcetab ",
+                "-keywords ",
+                "-stylesheetfile ",
+                "-docencoding ");
+
+        checkOutput("TestHelpOption.html", !withOption,
+                "<li><a href=\"help-doc.html\">Help</a></li>");
     }
 }
--- a/test/com/sun/javadoc/testHiddenMembers/TestHiddenMembers.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHiddenMembers/TestHiddenMembers.java	Fri May 09 15:37:12 2014 -0700
@@ -27,34 +27,37 @@
  * @summary Test to make sure that hidden overriden members are not
  * documented as inherited.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestHiddenMembers
  * @run main TestHiddenMembers
  */
 
 public class TestHiddenMembers extends JavadocTester {
 
-
-    //We should not inherit any members from BaseClass because they are all overriden and hidden
-    //(declared as private).
     private static final String[][] NEGATED_TEST = {
-        { "pkg/SubClass.html",
-            "inherited from class pkg.<A HREF=\"../pkg/BaseClass.html\">BaseClass</A>"}
+        { }
         };
     private static final String[] ARGS =
         new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
-            "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 {
         TestHiddenMembers tester = new TestHiddenMembers();
-        tester.run(ARGS, NO_TEST, NEGATED_TEST);
-        tester.printSummary();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
+
+        // We should not inherit any members from BaseClass because they are all overriden and hidden
+        // (declared as private).
+        // TODO: check normal case of generated tags: upper case of lower case
+        checkOutput("pkg/SubClass.html", false,
+            "inherited from class pkg.<A HREF=\"../pkg/BaseClass.html\">BaseClass</A>");
     }
 }
--- a/test/com/sun/javadoc/testHref/TestHref.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHref/TestHref.java	Fri May 09 15:37:12 2014 -0700
@@ -26,73 +26,57 @@
  * @bug      4663254 8016328 8025633 8026567
  * @summary  Verify that spaces do not appear in hrefs and anchors.
  * @author   jamieh
- * @library  ../lib/
- * @build    JavadocTester TestHref
+ * @library  ../lib
+ * @build    JavadocTester
  * @run main TestHref
  */
 
 public class TestHref extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-linkoffline",
-        "http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg"
-    };
+    public static void main(String... args) throws Exception {
+        TestHref tester = new TestHref();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] TEST = {
-        //External link.
-        { "pkg/C1.html",
-            "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\""
-        },
-        //Member summary table link.
-        { "pkg/C1.html",
-            "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\""
-        },
-        //Anchor test.
-        { "pkg/C1.html",
-            "<a name=\"method-int-int-java.util.ArrayList-\">\n" +
-            "<!--   -->\n" +
-            "</a>"
-        },
-        //Backward compatibility anchor test.
-        { "pkg/C1.html",
-            "<a name=\"method-int-int-java.util.ArrayList-\">\n" +
-            "<!--   -->\n" +
-            "</a>"
-        },
-        //{@link} test.
-        { "pkg/C2.html",
-            "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
-        },
-        //@see test.
-        { "pkg/C2.html",
-            "See Also:</span></dt>\n" +
-            "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
-        },
+    @Test
+    void test() {
+        javadoc("-Xdoclint:none",
+                "-d", "out",
+                "-sourcepath", testSrc,
+                "-linkoffline", "http://java.sun.com/j2se/1.4/docs/api/", testSrc,
+                "pkg");
+        checkExit(Exit.OK);
 
-        //Header does not link to the page itself.
-        { "pkg/C4.html",
-            "Class C4&lt;E extends C4&lt;E&gt;&gt;</h2>"
-        },
+        checkOutput("pkg/C1.html", true,
+                //External link.
+                "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"",
+                //Member summary table link.
+                "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"",
+                //Anchor test.
+                "<a name=\"method-int-int-java.util.ArrayList-\">\n"
+                + "<!--   -->\n"
+                + "</a>",
+                //Backward compatibility anchor test."pkg/C1.html",
+                "<a name=\"method-int-int-java.util.ArrayList-\">\n"
+                + "<!--   -->\n"
+                + "</a>");
 
-        //Signature does not link to the page itself.
-        { "pkg/C4.html",
-            "public abstract class <span class=\"typeNameLabel\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
-        },
-    };
-    private static final String[][] NEGATED_TEST =
-    {
-        {WARNING_OUTPUT,  "<a> tag is malformed"}
-    };
+        checkOutput("pkg/C2.html", true,
+                //{@link} test.
+                "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">",
+                //@see test.
+                "See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
+        );
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestHref tester = new TestHref();
-        tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("pkg/C4.html", true,
+                //Header does not link to the page itself.
+                "Class C4&lt;E extends C4&lt;E&gt;&gt;</h2>",
+                //Signature does not link to the page itself.
+                "public abstract class <span class=\"typeNameLabel\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
+        );
+
+        checkOutput(Output.WARNING, false,
+                "<a> tag is malformed");
     }
 }
--- a/test/com/sun/javadoc/testHrefInDocComment/TestHrefInDocComment.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHrefInDocComment/TestHrefInDocComment.java	Fri May 09 15:37:12 2014 -0700
@@ -27,26 +27,22 @@
  * @summary Determine if Hrefs are processed properly when they
  * appear in doc comments.
  * @author jamieh
- * @library ../lib/
+ * @library ../lib
  * @build JavadocTester
- * @build TestHrefInDocComment
  * @run main TestHrefInDocComment
  */
 
 public class TestHrefInDocComment extends JavadocTester {
 
-    private static final String[] ARGS =
-        new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"};
+    public static void main(String... args) throws Exception {
+        TestHrefInDocComment tester = new TestHrefInDocComment();
+        tester.runTests();
+    }
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestHrefInDocComment tester = new TestHrefInDocComment();
-        if (tester.run(ARGS, NO_TEST, NO_TEST) != 0) {
-            throw new Error("Javadoc failed to execute properly with given source.");
-        }
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc, "pkg");
+        checkExit(Exit.OK);
     }
 }
--- a/test/com/sun/javadoc/testHtmlComments/TestHtmlComments.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHtmlComments/TestHtmlComments.java	Fri May 09 15:37:12 2014 -0700
@@ -27,32 +27,26 @@
  * @summary  The field detail comment should not show up in the output if there
  *           are no fields to document.
  * @author   jamieh
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestHtmlComments
  * @run main TestHtmlComments
  */
 
 public class TestHtmlComments extends JavadocTester {
 
-    //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, SRC_DIR + "/C.java"
-    };
+    public static void main(String... args) throws Exception {
+        TestHtmlComments tester = new TestHtmlComments();
+        tester.runTests();
+    }
 
-    //Input for string search tests.
-    private static final String[][] NEGATED_TEST = {
-        { "C.html",
-            "<!-- ============ FIELD DETAIL =========== -->"}
-    };
+    @Test
+    void run() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                testSrc("C.java"));
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestHtmlComments tester = new TestHtmlComments();
-        tester.run(ARGS, NO_TEST, NEGATED_TEST);
-        tester.printSummary();
+        checkOutput("C.html", false,
+            "<!-- ============ FIELD DETAIL =========== -->");
     }
 }
--- a/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Fri May 09 15:37:12 2014 -0700
@@ -28,159 +28,250 @@
  * @bug 6786690 6820360 8025633 8026567
  * @summary This test verifies the nesting of definition list tags.
  * @author Bhavesh Patel
- * @library ../lib/
- * @build JavadocTester TestHtmlDefinitionListTag
+ * @library ../lib
+ * @build JavadocTester
  * @run main TestHtmlDefinitionListTag
  */
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 public class TestHtmlDefinitionListTag extends JavadocTester {
 
-    // Test common to all runs of javadoc. The class signature should print
-    // properly enclosed definition list tags and the Annotation Type
-    // Optional Element should print properly nested definition list tags
-    // for default value.
-    private static final String[][] TEST_ALL = {
-        { "pkg1/C1.html",
+    public static void main(String... args) throws Exception {
+        TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
+        tester.runTests();
+    }
+
+    @Test
+    void test_Comment_Deprecated() {
+//        tester.run(ARGS1, TEST_ALL, NEGATED_TEST_NO_C5);
+//        tester.runTestsOnHTML(NO_TEST,  NEGATED_TEST_C5);
+//        tester.runTestsOnHTML(TEST_CMNT_DEPR, NO_TEST);
+        javadoc("-Xdoclint:none",
+                "-d", "out-1",
+                "-sourcepath", testSrc,
+                "pkg1");
+        checkExit(Exit.OK);
+        checkCommon(true);
+        checkCommentDeprecated(true);
+    }
+
+    @Test
+    void test_NoComment_Deprecated() {
+//        tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5);
+//        tester.runTestsOnHTML(NO_TEST,  NEGATED_TEST_C5);
+//        tester.runTestsOnHTML(NO_TEST, TEST_CMNT_DEPR);
+        javadoc("-Xdoclint:none",
+                "-d", "out-2",
+                "-nocomment",
+                "-sourcepath", testSrc,
+                "pkg1");
+        checkExit(Exit.OK);
+        checkCommon(true);
+        checkCommentDeprecated(false); // ??
+    }
+
+    @Test
+    void test_Comment_NoDeprecated() {
+//        tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5);
+//        tester.runTestsOnHTML(TEST_NODEPR, TEST_NOCMNT_NODEPR);
+        javadoc("-Xdoclint:none",
+                "-d", "out-3",
+                "-nodeprecated",
+                "-sourcepath", testSrc,
+                "pkg1");
+        checkExit(Exit.OK);
+        checkCommon(false);
+        checkNoDeprecated();
+        checkNoCommentNoDeprecated(false);
+    }
+
+    @Test
+    void testNoCommentNoDeprecated() {
+//        tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5);
+//        tester.runTestsOnHTML(TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
+        javadoc("-Xdoclint:none",
+                "-d", "out-4",
+                "-nocomment",
+                "-nodeprecated",
+                "-sourcepath", testSrc,
+                "pkg1");
+        checkExit(Exit.OK);
+        checkCommon(false);
+        checkNoCommentNoDeprecated(true);
+        checkCommentDeprecated(false);
+    }
+
+    void checkCommon(boolean checkC5) {
+        // Test common to all runs of javadoc. The class signature should print
+        // properly enclosed definition list tags and the Annotation Type
+        // Optional Element should print properly nested definition list tags
+        // for default value.
+        checkOutput("pkg1/C1.html", true,
                 "<pre>public class <span class=\"typeNameLabel\">C1</span>\n" +
                 "extends java.lang.Object\n" +
-                "implements java.io.Serializable</pre>"},
-        { "pkg1/C4.html",
+                "implements java.io.Serializable</pre>");
+        checkOutput("pkg1/C4.html", true,
                 "<dl>\n" +
                 "<dt>Default:</dt>\n" +
                 "<dd>true</dd>\n" +
-                "</dl>"}};
+                "</dl>");
 
-    // Test for normal run of javadoc in which various ClassDocs and
-    // serialized form should have properly nested definition list tags
-    // enclosing comments, tags and deprecated information.
-    private static final String[][] TEST_CMNT_DEPR = {
-        { "pkg1/package-summary.html",
+        // Test for valid HTML generation which should not comprise of empty
+        // definition list tags.
+        List<String> files= new ArrayList<>(Arrays.asList(
+            "pkg1/package-summary.html",
+            "pkg1/C1.html",
+            "pkg1/C1.ModalExclusionType.html",
+            "pkg1/C2.html",
+            "pkg1/C2.ModalType.html",
+            "pkg1/C3.html",
+            "pkg1/C4.html",
+            "overview-tree.html",
+            "serialized-form.html"
+        ));
+
+        if (checkC5)
+            files.add("pkg1/C5.html");
+
+        for (String f: files) {
+            checkOutput(f, false,
+                    "<dl></dl>",
+                    "<dl>\n</dl>");
+        }
+    }
+
+    void checkCommentDeprecated(boolean expectFound) {
+        // Test for normal run of javadoc in which various ClassDocs and
+        // serialized form should have properly nested definition list tags
+        // enclosing comments, tags and deprecated information.
+        checkOutput("pkg1/package-summary.html", expectFound,
                 "<dl>\n" +
                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
                 "<dd>JDK1.0</dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
+                "</dl>");
+
+        checkOutput("pkg1/C1.html", expectFound,
+                "<dl>\n"
+                + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+                + "<dd>JDK1.0</dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>"
+                + "C2</code></a>, \n"
+                + "<a href=\"../serialized-form.html#pkg1.C1\">"
+                + "Serialized Form</a></dd>\n"
+                + "</dl>",
+                "<dl>\n"
+                + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+                + "<dd>1.4</dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>setUndecorated(boolean)</code></a></dd>\n"
+                + "</dl>",
+                "<dl>\n"
+                + "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+                + "<dd><code>title</code> - the title</dd>\n"
+                + "<dd><code>test</code> - boolean value"
+                + "</dd>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+                + "<dd><code>java.lang.IllegalArgumentException</code> - if the "
+                + "<code>owner</code>'s\n"
+                + "     <code>GraphicsConfiguration</code> is not from a screen "
+                + "device</dd>\n"
+                + "<dd><code>HeadlessException</code></dd>\n"
+                + "</dl>",
+                "<dl>\n"
+                + "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n"
+                + "<dd><code>undecorated"
+                + "</code> - <code>true</code> if no decorations are\n"
+                + "         to be enabled;\n"
+                + "         <code>false</code> "
+                + "if decorations are to be enabled.</dd>\n"
+                + "<dt><span class=\"simpleTagLabel\">Since:"
+                + "</span></dt>\n"
+                + "<dd>1.4</dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd>"
+                + "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()"
+                + "</code></a></dd>\n"
+                + "</dl>",
+                "<dl>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n"
+                + "<dd><code>java.io.IOException</code></dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:"
+                + "</span></dt>\n"
+                + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>setUndecorated(boolean)</code></a></dd>\n"
+                + "</dl>");
+
+        checkOutput("pkg1/C2.html", expectFound,
+                "<dl>\n"
+                + "<dt><span class=\"paramLabel\">Parameters:"
+                + "</span></dt>\n"
+                + "<dd><code>set</code> - boolean</dd>\n"
+                + "<dt><span class=\"simpleTagLabel\">"
+                + "Since:</span></dt>\n"
+                + "<dd>1.4</dd>\n"
+                + "</dl>");
+
+        checkOutput("serialized-form.html", expectFound,
+                "<dl>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:</span>"
+                + "</dt>\n"
+                + "<dd><code>"
+                + "java.io.IOException</code></dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span>"
+                + "</dt>\n"
+                + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+                + "</dl>",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>"
+                + "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+                + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+                + "<div class=\"block\">This field indicates whether the C1 is "
+                + "undecorated.</div>\n"
+                + "&nbsp;\n"
+                + "<dl>\n"
+                + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+                + "<dd>1.4</dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span>"
+                + "</dt>\n"
+                + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+                + "</dl>",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>"
+                + "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+                + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+                + "<div class=\"block\">Reads the object stream.</div>\n"
+                + "<dl>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:"
+                + "</span></dt>\n"
+                + "<dd><code><code>"
+                + "IOException</code></code></dd>\n"
+                + "<dd><code>java.io.IOException</code></dd>\n"
+                + "</dl>",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>"
+                + "&nbsp;</div>\n"
+                + "<div class=\"block\">The name for this class.</div>");
+    }
+
+    void checkNoDeprecated() {
+        // Test with -nodeprecated option. The ClassDocs should have properly nested
+        // definition list tags enclosing comments and tags. The ClassDocs should not
+        // display definition list for deprecated information. The serialized form
+        // should display properly nested definition list tags for comments, tags
+        // and deprecated information.
+        checkOutput("pkg1/package-summary.html", true,
                 "<dl>\n" +
                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
                 "<dd>JDK1.0</dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
-                "C2</code></a>, \n" +
-                "<a href=\"../serialized-form.html#pkg1.C1\">" +
-                "Serialized Form</a></dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                "<dd>1.4</dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>setUndecorated(boolean)</code></a></dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
-                "<dd><code>title</code> - the title</dd>\n" +
-                "<dd><code>test</code> - boolean value" +
-                "</dd>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
-                "<dd><code>java.lang.IllegalArgumentException</code> - if the " +
-                "<code>owner</code>'s\n" +
-                "     <code>GraphicsConfiguration</code> is not from a screen " +
-                "device</dd>\n" +
-                "<dd><code>HeadlessException</code></dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
-                "<dd><code>undecorated" +
-                "</code> - <code>true</code> if no decorations are\n" +
-                "         to be enabled;\n" +
-                "         <code>false</code> " +
-                "if decorations are to be enabled.</dd>\n" +
-                "<dt><span class=\"simpleTagLabel\">Since:" +
-                "</span></dt>\n" +
-                "<dd>1.4</dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                "<dd>" +
-                "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
-                "</code></a></dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
-                "<dd><code>java.io.IOException</code></dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:" +
-                "</span></dt>\n" +
-                "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>setUndecorated(boolean)</code></a></dd>\n" +
-                "</dl>"},
-        { "pkg1/C2.html",
-                "<dl>\n" +
-                "<dt><span class=\"paramLabel\">Parameters:" +
-                "</span></dt>\n" +
-                "<dd><code>set</code> - boolean</dd>\n" +
-                "<dt><span class=\"simpleTagLabel\">" +
-                "Since:</span></dt>\n" +
-                "<dd>1.4</dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<dl>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:</span>" +
-                "</dt>\n" +
-                "<dd><code>" +
-                "java.io.IOException</code></dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span>" +
-                "</dt>\n" +
-                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                "<div class=\"block\">This field indicates whether the C1 is " +
-                "undecorated.</div>\n" +
-                "&nbsp;\n" +
-                "<dl>\n" +
-                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                "<dd>1.4</dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span>" +
-                "</dt>\n" +
-                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                "<div class=\"block\">Reads the object stream.</div>\n" +
-                "<dl>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:" +
-                "</span></dt>\n" +
-                "<dd><code><code>" +
-                "IOException</code></code></dd>\n" +
-                "<dd><code>java.io.IOException</code></dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                "&nbsp;</div>\n" +
-                "<div class=\"block\">The name for this class.</div>"}};
+                "</dl>");
 
-    // Test with -nodeprecated option. The ClassDocs should have properly nested
-    // definition list tags enclosing comments and tags. The ClassDocs should not
-    // display definition list for deprecated information. The serialized form
-    // should display properly nested definition list tags for comments, tags
-    // and deprecated information.
-    private static final String[][] TEST_NODEPR = {
-        { "pkg1/package-summary.html",
-                "<dl>\n" +
-                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                "<dd>JDK1.0</dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
+        checkOutput("pkg1/C1.html", true,
                 "<dl>\n" +
                 "<dt><span class=\"simpleTagLabel\">Since:</span>" +
                 "</dt>\n" +
@@ -191,216 +282,124 @@
                 "<code>C2</code></a>, \n" +
                 "<a href=\"../serialized-form.html#pkg1.C1\">" +
                 "Serialized Form</a></dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "<dt><span class=\"paramLabel\">Parameters:" +
-                "</span></dt>\n" +
-                "<dd><code>title</code> - the title</dd>\n" +
-                "<dd><code>" +
-                "test</code> - boolean value</dd>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:" +
-                "</span></dt>\n" +
-                "<dd><code>java.lang.IllegalArgumentException" +
-                "</code> - if the <code>owner</code>'s\n" +
-                "     <code>GraphicsConfiguration" +
-                "</code> is not from a screen device</dd>\n" +
-                "<dd><code>" +
-                "HeadlessException</code></dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "<dt><span class=\"paramLabel\">Parameters:" +
-                "</span></dt>\n" +
-                "<dd><code>undecorated</code> - <code>true</code>" +
-                " if no decorations are\n" +
-                "         to be enabled;\n" +
-                "         <code>false</code> if decorations are to be enabled." +
-                "</dd>\n" +
-                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                "<dd>1.4</dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
-                "<code>readObject()</code></a></dd>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:</span>" +
-                "</dt>\n" +
-                "<dd><code>java.io.IOException</code></dd>\n" +
-                "<dt>" +
-                "<span class=\"seeLabel\">See Also:</span></dt>\n" +
-                "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>setUndecorated(boolean)</code></a></dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<dl>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:</span>" +
-                "</dt>\n" +
-                "<dd><code>" +
-                "java.io.IOException</code></dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span>" +
-                "</dt>\n" +
-                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                "<div class=\"block\">This field indicates whether the C1 is " +
-                "undecorated.</div>\n" +
-                "&nbsp;\n" +
-                "<dl>\n" +
-                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                "<dd>1.4</dd>\n" +
-                "<dt><span class=\"seeLabel\">See Also:</span>" +
-                "</dt>\n" +
-                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                "<div class=\"block\">Reads the object stream.</div>\n" +
-                "<dl>\n" +
-                "<dt><span class=\"throwsLabel\">Throws:" +
-                "</span></dt>\n" +
-                "<dd><code><code>" +
-                "IOException</code></code></dd>\n" +
-                "<dd><code>java.io.IOException</code></dd>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                "&nbsp;</div>\n" +
-                "<div class=\"block\">" +
-                "The name for this class.</div>"}};
+                "</dl>");
 
-    // Test with -nocomment and -nodeprecated options. The ClassDocs whould
-    // not display definition lists for any member details.
-    private static final String[][] TEST_NOCMNT_NODEPR = {
-        { "pkg1/C1.html",
+        checkOutput("pkg1/C1.html", true,
+                "<dl>\n"
+                + "<dt><span class=\"paramLabel\">Parameters:"
+                + "</span></dt>\n"
+                + "<dd><code>title</code> - the title</dd>\n"
+                + "<dd><code>"
+                + "test</code> - boolean value</dd>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:"
+                + "</span></dt>\n"
+                + "<dd><code>java.lang.IllegalArgumentException"
+                + "</code> - if the <code>owner</code>'s\n"
+                + "     <code>GraphicsConfiguration"
+                + "</code> is not from a screen device</dd>\n"
+                + "<dd><code>"
+                + "HeadlessException</code></dd>\n"
+                + "</dl>",
+                "<dl>\n"
+                + "<dt><span class=\"paramLabel\">Parameters:"
+                + "</span></dt>\n"
+                + "<dd><code>undecorated</code> - <code>true</code>"
+                + " if no decorations are\n"
+                + "         to be enabled;\n"
+                + "         <code>false</code> if decorations are to be enabled."
+                + "</dd>\n"
+                + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+                + "<dd>1.4</dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg1/C1.html#readObject--\">"
+                + "<code>readObject()</code></a></dd>\n"
+                + "</dl>",
+                "<dl>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:</span>"
+                + "</dt>\n"
+                + "<dd><code>java.io.IOException</code></dd>\n"
+                + "<dt>"
+                + "<span class=\"seeLabel\">See Also:</span></dt>\n"
+                + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>setUndecorated(boolean)</code></a></dd>\n"
+                + "</dl>");
+
+        checkOutput("serialized-form.html", true,
+                "<dl>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:</span>"
+                + "</dt>\n"
+                + "<dd><code>"
+                + "java.io.IOException</code></dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span>"
+                + "</dt>\n"
+                + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+                + "</dl>",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>"
+                + "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+                + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+                + "<div class=\"block\">This field indicates whether the C1 is "
+                + "undecorated.</div>\n"
+                + "&nbsp;\n"
+                + "<dl>\n"
+                + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+                + "<dd>1.4</dd>\n"
+                + "<dt><span class=\"seeLabel\">See Also:</span>"
+                + "</dt>\n"
+                + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>C1.setUndecorated(boolean)</code></a></dd>\n"
+                + "</dl>",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>"
+                + "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n"
+                + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">"
+                + "<code>setUndecorated(boolean)</code></a>.</span></div>\n"
+                + "<div class=\"block\">Reads the object stream.</div>\n"
+                + "<dl>\n"
+                + "<dt><span class=\"throwsLabel\">Throws:"
+                + "</span></dt>\n"
+                + "<dd><code><code>"
+                + "IOException</code></code></dd>\n"
+                + "<dd><code>java.io.IOException</code></dd>\n"
+                + "</dl>",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>"
+                + "&nbsp;</div>\n"
+                + "<div class=\"block\">"
+                + "The name for this class.</div>");
+    }
+
+    void checkNoCommentNoDeprecated(boolean expectFound) {
+        // Test with -nocomment and -nodeprecated options. The ClassDocs whould
+        // not display definition lists for any member details.
+        checkOutput("pkg1/C1.html", expectFound,
                 "<pre>public&nbsp;void&nbsp;readObject()\n" +
                 "                throws java.io.IOException</pre>\n" +
-                "</li>"},
-        { "pkg1/C2.html", "<pre>public&nbsp;C2()</pre>\n" +
-                "</li>"},
-        { "pkg1/C1.ModalExclusionType.html", "<pre>public " +
+                "</li>");
+
+        checkOutput("pkg1/C2.html", expectFound,
+                "<pre>public&nbsp;C2()</pre>\n" +
+                "</li>");
+
+        checkOutput("pkg1/C1.ModalExclusionType.html", expectFound,
+                "<pre>public " +
                 "static final&nbsp;<a href=\"../pkg1/C1.ModalExclusionType.html\" " +
                 "title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
                 "APPLICATION_EXCLUDE</pre>\n" +
-                "</li>"},
-        { "serialized-form.html", "<pre>boolean " +
+                "</li>");
+
+        checkOutput("serialized-form.html", expectFound,
+                "<pre>boolean " +
                 "undecorated</pre>\n" +
                 "<div class=\"block\"><span class=\"deprecatedLabel\">" +
                 "Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
                 "setUndecorated(boolean)</code></a>.</span></div>\n" +
-                "</li>"},
-        { "serialized-form.html", "<span class=\"deprecatedLabel\">" +
+                "</li>",
+                "<span class=\"deprecatedLabel\">" +
                 "Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version" +
                 " 1.5, replaced by\n" +
                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
                 "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                "</li>"}};
-
-    // 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",
-                "<dl></dl>"},
-        { "pkg1/package-summary.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "pkg1/C1.html",
-                "<dl></dl>"},
-        { "pkg1/C1.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "pkg1/C1.ModalExclusionType.html",
-                "<dl></dl>"},
-        { "pkg1/C1.ModalExclusionType.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "pkg1/C2.html",
-                "<dl></dl>"},
-        { "pkg1/C2.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "pkg1/C2.ModalType.html",
-                "<dl></dl>"},
-        { "pkg1/C2.ModalType.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "pkg1/C3.html",
-                "<dl></dl>"},
-        { "pkg1/C3.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "pkg1/C4.html",
-                "<dl></dl>"},
-        { "pkg1/C4.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "overview-tree.html",
-                "<dl></dl>"},
-        { "overview-tree.html",
-                "<dl>\n" +
-                "</dl>"},
-        { "serialized-form.html",
-                "<dl></dl>"},
-        { "serialized-form.html",
-                "<dl>\n" +
-                "</dl>"}};
-    private static final String[][] NEGATED_TEST_C5 = {
-        { "pkg1/C5.html",
-                "<dl></dl>"},
-        { "pkg1/C5.html",
-                "<dl>\n" +
-                "</dl>"}};
-
-    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();
+                "</li>");
     }
 }
--- a/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHtmlDocument/TestHtmlDocument.java	Fri May 09 15:37:12 2014 -0700
@@ -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 @@
         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();
-    }
 }
--- a/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java	Fri May 09 15:37:12 2014 -0700
@@ -26,44 +26,49 @@
 /*
  * @test
  * @bug 6786028 8026567
- * @summary This test verifys the use of <strong> HTML tag instead of <B> by Javadoc std doclet.
+ * @summary This test verifies the use of <strong> HTML tag instead of <B> 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",
-            "<span class=\"seeLabel\">See Also:</span>"}};
-    private static final String[][] NEGATED_TEST1 = {
-        { "pkg1/C1.html", "<STRONG>Method Summary</STRONG>"},
-        { "pkg1/C1.html", "<B>"},
-        { "pkg1/package-summary.html",
-            "<STRONG>Class Summary</STRONG>"}};
-    private static final String[][] TEST2 = {
-        { "pkg2/C2.html", "<B>Comments:</B>"}};
-    private static final String[][] NEGATED_TEST2 = {
-        { "pkg2/C2.html", "<STRONG>Method Summary</STRONG>"}};
+    public static void main(String... args) throws Exception {
+        TestHtmlStrongTag tester = new TestHtmlStrongTag();
+        tester.runTests();
+    }
 
-    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"};
+    @Test
+    void test1() {
+        javadoc("-d", "out-1",
+                "-sourcepath", testSrc,
+                "pkg1");
+        checkExit(Exit.OK);
 
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) {
-        TestHtmlStrongTag tester = new TestHtmlStrongTag();
-        tester.run(ARGS1, TEST1, NEGATED_TEST1);
-        tester.run(ARGS2, TEST2, NEGATED_TEST2);
-        tester.printSummary();
+        checkOutput("pkg1/C1.html", true,
+            "<span class=\"seeLabel\">See Also:</span>");
+
+        checkOutput("pkg1/C1.html", false,
+            "<STRONG>Method Summary</STRONG>",
+            "<B>");
+
+        checkOutput("pkg1/package-summary.html", false,
+            "<STRONG>Class Summary</STRONG>");
+    }
+
+    @Test
+    void test2() {
+        javadoc("-d", "out-2",
+                "-sourcepath", testSrc,
+                "pkg2");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg2/C2.html", true,
+                "<B>Comments:</B>");
+
+        checkOutput("pkg2/C2.html", false,
+                "<STRONG>Method Summary</STRONG>");
     }
 }
--- a/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHtmlTableStyles/TestHtmlTableStyles.java	Fri May 09 15:37:12 2014 -0700
@@ -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",
-            "<table border cellpadding=3 cellspacing=1>"
-        },
-        { "pkg1/TestTable.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
-            "and an explanation\">"
-        },
-        { "pkg1/TestTable.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
-            "constructors, and an explanation\">"
-        },
-        { "pkg1/TestTable.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
-            "and an explanation\">"
-        },
-        { "pkg1/package-summary.html",
-            "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Class Summary table, listing classes, " +
-            "and an explanation\">"
-        },
-        { "pkg1/class-use/TestTable.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">"
-        },
-        { "overview-summary.html",
-            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">"
-        },
-        { "deprecated-list.html",
+    public static void main(String... args) throws Exception {
+        TestHtmlTableStyles tester = new TestHtmlTableStyles();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-use",
+                "pkg1", "pkg2");
+        checkExit(Exit.OK);
+
+        checkOutput("pkg1/TestTable.html", true,
+                "<table border cellpadding=3 cellspacing=1>",
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
+                + "and an explanation\">",
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
+                + "constructors, and an explanation\">",
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
+                + "and an explanation\">");
+
+        checkOutput("pkg1/package-summary.html", true,
+                "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Class Summary table, listing classes, "
+                + "and an explanation\">");
+
+        checkOutput("pkg1/class-use/TestTable.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Use table, listing fields, and an explanation\">");
+
+        checkOutput("overview-summary.html", true,
+                "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Packages table, listing packages, and an explanation\">");
+
+        checkOutput("deprecated-list.html", true,
             "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" " +
             "cellspacing=\"0\" summary=\"Deprecated Methods table, listing " +
-            "deprecated methods, and an explanation\">"
-        },
-        { "constant-values.html",
+            "deprecated methods, and an explanation\">");
+
+        checkOutput("constant-values.html", true,
             "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" " +
             "cellspacing=\"0\" summary=\"Constant Field Values table, listing " +
-            "constant fields, and values\">"
-        },
-    };
-
-    private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
-    };
-
-    /**
-     * The entry point of the test.
-     * @param args the array of command line arguments.
-     */
-    public static void main(String[] args) throws Exception {
-        TestHtmlTableStyles tester = new TestHtmlTableStyles();
-        tester.run(ARGS, TEST, NO_TEST);
-        tester.printSummary();
+            "constant fields, and values\">");
     }
 }
--- a/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java	Fri May 09 23:31:05 2014 +0200
+++ b/test/com/sun/javadoc/testHtmlTableTags/TestHtmlTableTags.java	Fri May 09 15:37:12 2014 -0700
@@ -26,9 +26,8 @@
  * @bug      6786688 8008164
  * @summary  HTML tables should have table summary, caption and table headers.
  * @author   Bhavesh Patel
- * @library  ../lib/
+ * @library  ../lib
  * @build    JavadocTester
- * @build    TestHtmlTableTags
  * @run main TestHtmlTableTags
  */
 
@@ -36,400 +35,350 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
+
     };
 
-    //Input for string tests for HTML table tags.
-    private static final String[][] TABLE_TAGS_TEST = {
-        /*
-         * Test for validating summary for HTML tables
-         */
 
+    public static void main(String... args) throws Exception {
+        TestHtmlTableTags tester = new TestHtmlTableTags();
+        tester.runTests();
+    }
+
+    @Test
+    void test() {
+        javadoc("-d", "out",
+                "-sourcepath", testSrc,
+                "-use",
+                "pkg1", "pkg2");
+        checkExit(Exit.OK);
+
+        checkHtmlTableSummaries();
+        checkHtmlTableCaptions();
+        checkHtmlTableHeaders();
+    }
+
+    /*
+     * Tests for validating summary for HTML tables
+     */
+    void checkHtmlTableSummaries() {
         //Package summary
-        { "pkg1/package-summary.html",
-            "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
-            " cellspacing=\"0\" summary=\"Class Summary table, " +
-            "listing classes, and an explanation\">"
-        },
-        { "pkg1/package-summary.html",
-            "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
-            " cellspacing=\"0\" summary=\"Interface Summary table, " +
-            "listing interfaces, and an explanation\">"
-        },
-        { "pkg2/package-summary.html",
-            "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
-            " cellspacing=\"0\" summary=\"Enum Summary table, " +
-            "listing enums, and an explanation\">"
-        },
-        { "pkg2/package-summary.html",
-            "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
-            " cellspacing=\"0\" summary=\"Annotation Types Summary table, " +
-            "listing annotation types, and an explanation\">"
-        },
+        checkOutput("pkg1/package-summary.html", true,
+                "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+                + " cellspacing=\"0\" summary=\"Class Summary table, "
+                + "listing classes, and an explanation\">",
+                "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+                + " cellspacing=\"0\" summary=\"Interface Summary table, "
+                + "listing interfaces, and an explanation\">");
+
+        checkOutput("pkg2/package-summary.html", true,
+                "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+                + " cellspacing=\"0\" summary=\"Enum Summary table, "
+                + "listing enums, and an explanation\">",
+                "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\""
+                + " cellspacing=\"0\" summary=\"Annotation Types Summary table, "
+                + "listing annotation types, and an explanation\">");
+
         // Class documentation
-        { "pkg1/C1.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
-            "and an explanation\">"
-        },
-        { "pkg1/C1.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
-            "and an explanation\">"
-        },
-        { "pkg2/C2.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Nested Class Summary table, listing " +
-            "nested classes, and an explanation\">"
-        },
-        { "pkg2/C2.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
-            "constructors, and an explanation\">"
-        },
-        { "pkg2/C2.ModalExclusionType.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing " +
-            "enum constants, and an explanation\">"
-        },
-        { "pkg2/C3.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Required Element Summary table, " +
-            "listing required elements, and an explanation\">"
-        },
-        { "pkg2/C4.html",
-            "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Optional Element Summary table, " +
-            "listing optional elements, and an explanation\">"
-        },
+        checkOutput("pkg1/C1.html", true,
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Field Summary table, listing fields, "
+                + "and an explanation\">",
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Method Summary table, listing methods, "
+                + "and an explanation\">");
+
+        checkOutput("pkg2/C2.html", true,
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Nested Class Summary table, listing "
+                + "nested classes, and an explanation\">",
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Constructor Summary table, listing "
+                + "constructors, and an explanation\">");
+
+        checkOutput("pkg2/C2.ModalExclusionType.html", true,
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing "
+                + "enum constants, and an explanation\">");
+
+        checkOutput("pkg2/C3.html", true,
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Required Element Summary table, "
+                + "listing required elements, and an explanation\">");
+
+        checkOutput("pkg2/C4.html", true,
+                "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Optional Element Summary table, "
+                + "listing optional elements, and an explanation\">");
+
         // Class use documentation
-        { "pkg1/class-use/I1.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing packages, and an explanation\">"
-        },
-        { "pkg1/class-use/C1.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing fields, and an explanation\">"
-        },
-        { "pkg1/class-use/C1.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing methods, and an explanation\">"
-        },
-        { "pkg2/class-use/C2.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing fields, and an explanation\">"
-        },
-        { "pkg2/class-use/C2.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing methods, and an explanation\">"
-        },
-        { "pkg2/class-use/C2.ModalExclusionType.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing packages, and an explanation\">"
-        },
-        { "pkg2/class-use/C2.ModalExclusionType.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing methods, and an explanation\">"
-        },
+        checkOutput("pkg1/class-use/I1.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing packages, and an explanation\">");
+
+        checkOutput("pkg1/class-use/C1.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing fields, and an explanation\">",
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing methods, and an explanation\">");
+
+        checkOutput("pkg2/class-use/C2.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing fields, and an explanation\">",
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing methods, and an explanation\">");
+
+        checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing packages, and an explanation\">");
+
+        checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing methods, and an explanation\">");
+
         // Package use documentation
-        { "pkg1/package-use.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing packages, and an explanation\">"
-        },
-        { "pkg1/package-use.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing classes, and an explanation\">"
-        },
-        { "pkg2/package-use.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing packages, and an explanation\">"
-        },
-        { "pkg2/package-use.html",
-            "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
-            "table, listing classes, and an explanation\">"
-        },
+        checkOutput("pkg1/package-use.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing packages, and an explanation\">",
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing classes, and an explanation\">");
+
+        checkOutput("pkg2/package-use.html", true,
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing packages, and an explanation\">",
+                "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use "
+                + "table, listing classes, and an explanation\">");
+
         // Deprecated
-        { "deprecated-list.html",
-            "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
-            "summary=\"Deprecated Fields table, listing deprecated fields, " +
-            "and an explanation\">"
-        },
-        { "deprecated-list.html",
-            "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
-            "summary=\"Deprecated Methods table, listing deprecated methods, " +
-            "and an explanation\">"
-        },
+        checkOutput("deprecated-list.html", true,
+                "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+                + "summary=\"Deprecated Fields table, listing deprecated fields, "
+                + "and an explanation\">",
+                "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+                + "summary=\"Deprecated Methods table, listing deprecated methods, "
+                + "and an explanation\">");
+
         // Constant values
-        { "constant-values.html",
-            "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
-            "summary=\"Constant Field Values table, listing " +
-            "constant fields, and values\">"
-        },
+        checkOutput("constant-values.html", true,
+                "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" "
+                + "summary=\"Constant Field Values table, listing "
+                + "constant fields, and values\">");
+
         // Overview Summary
-        { "overview-summary.html",
-            "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
-            "cellspacing=\"0\" summary=\"Packages table, " +
-            "listing packages, and an explanation\">"
-        },
+        checkOutput("overview-summary.html", true,
+                "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" "
+                + "cellspacing=\"0\" summary=\"Packages table, "
+                + "listing packages, and an explanation\">");
+    }
 
-        /*
-         * Test for validating caption for HTML tables
-         */
+    /*
+     * Tests for validating caption for HTML tables
+     */
+    void checkHtmlTableCaptions() {
+        //Package summary
+        checkOutput("pkg1/package-summary.html", true,
+                "<caption><span>Class Summary</span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>",
+                "<caption><span>Interface Summary</span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>");
 
+        checkOutput("pkg2/package-summary.html", true,
+                "<caption><span>Enum Summary</span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>",
+                "<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>");
+
+        // Class documentation
+        checkOutput("pkg1/C1.html", true,
+                "<caption><span>Fields</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All "
+                + "Methods</span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">"
+                + "Instance Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">"
+                + "Concrete Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">"
+                + "Deprecated Methods</a></span><span class=\"tabEnd\">&nbsp;</span></span>"
+                + "</caption>");
+
+        checkOutput("pkg2/C2.html", true,
+                "<caption><span>Nested Classes</span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<caption><span>Constructors</span><span class=\"tabEnd\">&nbsp;</span></caption>");
+
+        checkOutput("pkg2/C2.ModalExclusionType.html", true,
+                "<caption><span>Enum Constants</span><span class=\"tabEnd\">&nbsp;</span></caption>");
+
+        checkOutput("pkg2/C3.html", true,
+                "<caption><span>Required Elements</span><span class=\"tabEnd\">&nbsp;"
+                + "</span></caption>");
+
+        checkOutput("pkg2/C4.html", true,
+                "<caption><span>Optional Elements</span><span class=\"tabEnd\">&nbsp;"
+                + "</span></caption>");
+
+        // Class use documentation
+        checkOutput("pkg1/class-use/I1.html", true,
+                "<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" "
+                + "title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>");
+
+        checkOutput("pkg1/class-use/C1.html", true,
+                "<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">"
+                + "pkg2</a> declared as <a href=\"../../pkg1/C1.html\" "
+                + "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">&nbsp;"
+                + "</span></caption>",
+                "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">"
+                + "pkg2</a> that return <a href=\"../../pkg1/C1.html\" "
+                + "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>");
+
+        checkOutput("pkg2/class-use/C2.html", true,
+                "<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">"
+                + "pkg1</a> declared as <a href=\"../../pkg2/C2.html\" "
+                + "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>",
+                "<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">"
+                + "pkg1</a> that return <a href=\"../../pkg2/C2.html\" "
+                + "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>");
+
+        checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true,
+                "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">"
+                + "pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" "
+                + "title=\"enum in pkg2\">C2.ModalExclusionType</a></span>"
+                + "<span class=\"tabEnd\">&nbsp;</span></caption>");
+
+        // Package use documentation
+        checkOutput("pkg1/package-use.html", true,
+                "<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">"
+                + "pkg1</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">"
+                + "pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>"
+                + "</span><span class=\"tabEnd\">&nbsp;</span></caption>");
+
+        checkOutput("pkg2/package-use.html", true,
+                "<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">"
+                + "pkg2</a></span><span class=\"tabEnd\">&nbsp;</span></caption>",
+                "<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">"
+                + "pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>"
+                + "</span><span class=\"tabEnd\">&nbsp;</span></caption>");
+
+        // Deprecated
+        checkOutput("deprecated-list.html", true,
+                "<caption><span>Deprecated Fields</span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>",
+                "<caption><span>Deprecated Methods</span><span class=\"tabEnd\">"
+                + "&nbsp;</span></caption>");
+
+        // Constant values
+        checkOutput("constant-values.html", true,
+                "<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">"
+                + "C1</a></span><span class=\"tabEnd\">&nbsp;</span></caption>");
+
+        // Overview Summary
+        checkOutput("overview-summary.html", true,
+                "<caption><span>Packages</span><span class=\"tabEnd\">&nbsp;</span></caption>");
+    }
+
+    /*
+     * Test for validating headers for HTML tables
+     */
+    void checkHtmlTableHeaders() {
         //Package summary
-        { "pkg1/package-summary.html",
-            "<caption><span>Class Summary</span><span class=\"tabEnd\">" +
-            "&nbsp;</span></caption>"
-        },
-        { "pkg1/package-summary.html",
-            "<caption><span>Interface Summary</span><span class=\"tabEnd\">" +
-            "&nbsp;</span></caption>"
-        },
-        { "pkg2/package-summary.html",
-            "<caption><span>Enum Summary</span><span class=\"tabEnd\">" +
-            "&nbsp;</span></caption>"
-        },
-        { "pkg2/package-summary.html",
-            "<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">" +
-            "&nbsp;</span></caption>"
-        },
+        checkOutput("pkg1/package-summary.html", true,
+                "<th class=\"colFirst\" scope=\"col\">"
+                + "Class</th>\n"
+                + "<th class=\"colLast\" scope=\"col\""
+                + ">Description</th>",
+                "<th class=\"colFirst\" scope=\"col\">"
+                + "Interface</th>\n"
+                + "<th class=\"colLast\" scope=\"col\""
+                + ">Description</th>");
+
+        checkOutput("pkg2/package-summary.html", true,
+                "<th class=\"colFirst\" scope=\"col\">"
+                + "Enum</th>\n"
+                + "<th class=\"colLast\" scope=\"col\""
+                + ">Description</th>",
+                "<th class=\"colFirst\" scope=\"col\">"
+                + "Annotation Type</th&