8040904: Ensure javadoc tests do not overwrite results within tests

Reviewed-by: ksrini
This commit is contained in:
Jonathan Gibbons 2014-04-25 13:08:41 -07:00
parent e5a91499f0
commit 6c24c7e153
13 changed files with 384 additions and 293 deletions

View File

@ -113,6 +113,46 @@ public abstract class JavadocTester {
*/
private File outputDir;
/**
* Alternatives for checking the contents of a directory.
*/
enum DirectoryCheck {
/**
* Check that the directory is empty.
*/
EMPTY((file, name) -> true),
/**
* Check that the directory does not contain any HTML files,
* such as may have been generated by a prior run of javadoc
* using this directory.
* For now, the check is only performed on the top level directory.
*/
NO_HTML_FILES((file, name) -> name.endsWith(".html")),
/**
* No check is performed on the directory contents.
*/
NONE(null) { @Override void check(File dir) { } };
/** The filter used to detect that files should <i>not</i> be present. */
FilenameFilter filter;
DirectoryCheck(FilenameFilter f) {
filter = f;
}
void check(File dir) {
if (dir.isDirectory()) {
String[] contents = dir.list(filter);
if (contents == null)
throw new Error("cannot list directory: " + dir);
if (contents.length > 0)
throw new Error("directory has unexpected content: " + dir);
}
}
}
private DirectoryCheck outputDirectoryCheck = DirectoryCheck.EMPTY;
/**
* The current subtest number.
*/
@ -206,6 +246,8 @@ public abstract class JavadocTester {
}
}
outputDirectoryCheck.check(outputDir);
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
PrintStream prevOut = System.out;
System.setOut(new PrintStream(stdout));
@ -231,6 +273,15 @@ public abstract class JavadocTester {
return returnCode;
}
/**
* Set a filter to check the initial contents of the output directory
* before javadoc is run.
* The filter should return true for files that should <b>not</b> appear.
*/
public void setCheckOutputDirectoryCheck(DirectoryCheck c) {
outputDirectoryCheck = c;
}
/**
* Create new string writer buffers
*/

View File

@ -86,10 +86,12 @@ public class TestDocFileDir extends JavadocTester {
*/
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();
}

View File

@ -58,7 +58,7 @@ public class TestGeneratedBy extends JavadocTester {
private static final String[] NO_TIMESTAMP_ARGS =
new String[] {
"-notimestamp",
"-d", OUTPUT_DIR,
"-d", OUTPUT_DIR + "-1",
"-sourcepath", SRC_DIR,
"pkg"
};

View File

@ -45,7 +45,7 @@ public class TestGroupOption extends JavadocTester {
};
private static final String[] ARGS2 = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
"-group", "Package One", "pkg1",
"-group", "Package One", "pkg2",
"-group", "Package One", "pkg3",

View File

@ -40,127 +40,134 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
// Optional Element should print properly nested definition list tags
// for default value.
private static final String[][] TEST_ALL = {
{ "pkg1/C1.html", "<pre>public class " +
"<span class=\"typeNameLabel\">C1</span>\n" +
"extends java.lang.Object\n" +
"implements java.io.Serializable</pre>"},
{ "pkg1/C4.html", "<dl>\n" +
"<dt>Default:</dt>\n" +
"<dd>true</dd>\n" +
"</dl>"}};
{ "pkg1/C1.html",
"<pre>public class <span class=\"typeNameLabel\">C1</span>\n" +
"extends java.lang.Object\n" +
"implements java.io.Serializable</pre>"},
{ "pkg1/C4.html",
"<dl>\n" +
"<dt>Default:</dt>\n" +
"<dd>true</dd>\n" +
"</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", "<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
"</dl>"},
{ "pkg1/C1.html", "<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>"},
{ "pkg1/package-summary.html",
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<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",
"<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>"},
"<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\">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;<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;</div>\n" +
"<div class=\"block\">The name for this class.</div>"}};
"<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>"}};
// Test with -nodeprecated option. The ClassDocs should have properly nested
// definition list tags enclosing comments and tags. The ClassDocs should not
@ -168,183 +175,210 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
// 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", "<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=\"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>"},
{ "pkg1/package-summary.html",
"<dl>\n" +
"<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
"<dd>JDK1.0</dd>\n" +
"</dl>"},
{ "pkg1/C1.html",
"<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=\"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",
"<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>"},
"<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\">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;<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;</div>\n" +
"<div class=\"block\">" +
"The name for this class.</div>"}};
"<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>"}};
// 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",
"<pre>public&nbsp;void&nbsp;readObject()\n" +
" throws java.io.IOException</pre>\n" +
"</li>"},
"<pre>public&nbsp;void&nbsp;readObject()\n" +
" throws java.io.IOException</pre>\n" +
"</li>"},
{ "pkg1/C2.html", "<pre>public&nbsp;C2()</pre>\n" +
"</li>"},
"</li>"},
{ "pkg1/C1.ModalExclusionType.html", "<pre>public " +
"static final&nbsp;<a href=\"../pkg1/C1.ModalExclusionType.html\" " +
"title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
"APPLICATION_EXCLUDE</pre>\n" +
"</li>"},
"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 " +
"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>"},
"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\">" +
"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>"}};
"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 = {
{ "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>"},
{ "pkg1/C5.html", "<dl></dl>"},
{ "pkg1/C5.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_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, "-sourcepath", SRC_DIR, "pkg1"};
"-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR, "-nocomment", "-sourcepath",
"-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath",
SRC_DIR, "pkg1"};
private static final String[] ARGS3 =
new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR, "-nodeprecated", "-sourcepath",
"-Xdoclint:none", "-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath",
SRC_DIR, "pkg1"};
private static final String[] ARGS4 =
new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR, "-nocomment", "-nodeprecated",
"-Xdoclint:none", "-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated",
"-sourcepath", SRC_DIR, "pkg1"};
/**
@ -353,14 +387,20 @@ public class TestHtmlDefinitionListTag extends JavadocTester {
*/
public static void main(String[] args) {
TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
tester.run(ARGS1, TEST_ALL, NEGATED_TEST);
tester.run(ARGS1, TEST_CMNT_DEPR, NEGATED_TEST);
tester.run(ARGS2, TEST_ALL, NEGATED_TEST);
tester.run(ARGS2, NO_TEST, TEST_CMNT_DEPR);
tester.run(ARGS3, TEST_ALL, NEGATED_TEST);
tester.run(ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
tester.run(ARGS4, TEST_ALL, NEGATED_TEST);
tester.run(ARGS4, TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
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();
}
}

View File

@ -47,16 +47,14 @@ public class TestHtmlStrongTag extends JavadocTester {
private static final String[][] TEST2 = {
{ "pkg2/C2.html", "<B>Comments:</B>"}};
private static final String[][] NEGATED_TEST2 = {
{ "pkg2/C2.html", "<STRONG>Method Summary</STRONG>"},
{ "pkg1/package-summary.html",
"<STRONG>Class Summary</STRONG>"}};
{ "pkg2/C2.html", "<STRONG>Method Summary</STRONG>"}};
private static final String[] ARGS1 =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg2"};
"-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
/**
* The entry point of the test.

View File

@ -58,13 +58,13 @@ public class TestHtmlTag extends JavadocTester {
private static final String[] ARGS1 =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-locale", "ja", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg2"};
"-locale", "ja", "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
private static final String[] ARGS3 =
new String[] {
"-locale", "en_US", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
"-locale", "en_US", "-d", OUTPUT_DIR + "-3", "-sourcepath", SRC_DIR, "pkg1"};
/**
* The entry point of the test.

View File

@ -79,8 +79,8 @@ public class TestLinkOption extends JavadocTester {
private static final String[][] TEST2 = {
{ "pkg2/C2.html",
"This is a link to <a href=\"../../" + OUTPUT_DIR +
"-1/pkg/C.html?is-external=true\" " +
"This is a link to <a href=\"../../" +
OUTPUT_DIR + "-1/pkg/C.html?is-external=true\" " +
"title=\"class or interface in pkg\"><code>Class C</code></a>."
}
};
@ -119,7 +119,6 @@ public class TestLinkOption extends JavadocTester {
public static void main(String[] args) {
TestLinkOption tester = new TestLinkOption();
tester.run(ARGS1, TEST1, NEGATED_TEST1);
tester.run(ARGS1, TEST1, NEGATED_TEST1);
tester.run(ARGS2, TEST2, NO_TEST);
tester.runJavadoc(createArguments(true)); // with trailing slash
tester.runJavadoc(createArguments(false)); // without trailing slash

View File

@ -67,7 +67,9 @@ public class TestNotifications extends JavadocTester {
tester.run(ARGS, TEST, NO_TEST);
// No need to notify that the destination must be created because
// it already exists.
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
tester.run(ARGS, NO_TEST, NEGATED_TEST);
tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
//Make sure classname is not include in javadoc usage message.
tester.run(ARGS2, NO_TEST, NEGATED_TEST2);
tester.printSummary();

View File

@ -115,19 +115,19 @@ public class TestSerializedFormDeprecationInfo extends JavadocTester {
private static final String[] ARGS1 =
new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS2 =
new String[] {
"-d", OUTPUT_DIR, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
"-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS3 =
new String[] {
"-d", OUTPUT_DIR, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
"-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
private static final String[] ARGS4 =
new String[] {
"-d", OUTPUT_DIR, "-nocomment", "-nodeprecated", "-sourcepath",
"-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated", "-sourcepath",
SRC_DIR, "pkg1"};
/**

View File

@ -35,11 +35,11 @@ public class TestSinceTag extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS1 = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
"-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"
};
private static final String[] ARGS2 = new String[] {
"-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-nosince", "pkg1"
"-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-nosince", "pkg1"
};
//Input for string search tests.

View File

@ -39,11 +39,11 @@ public class TestTypeParameters extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS1 = new String[]{
"-d", OUTPUT_DIR, "-use", "-sourcepath", SRC_DIR,
"-d", OUTPUT_DIR + "-1", "-use", "-sourcepath", SRC_DIR,
"pkg"
};
private static final String[] ARGS2 = new String[]{
"-d", OUTPUT_DIR, "-linksource", "-sourcepath", SRC_DIR,
"-d", OUTPUT_DIR + "-2", "-linksource", "-sourcepath", SRC_DIR,
"pkg"
};

View File

@ -40,11 +40,11 @@ public class TestWarnings extends JavadocTester {
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
"-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg"
};
private static final String[] ARGS2 = new String[] {
"-Xdoclint:none", "-d", OUTPUT_DIR, "-private", "-sourcepath", SRC_DIR,
"-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-private", "-sourcepath", SRC_DIR,
"pkg"
};
@ -78,7 +78,6 @@ public class TestWarnings extends JavadocTester {
public static void main(String[] args) {
TestWarnings tester = new TestWarnings();
tester.run(ARGS, TEST, NEGATED_TEST);
tester.run(ARGS, TEST, NEGATED_TEST);
tester.run(ARGS2, TEST2, NO_TEST);
tester.printSummary();
}