232N/A/*
957N/A * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
232N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
232N/A *
232N/A * This code is free software; you can redistribute it and/or modify it
232N/A * under the terms of the GNU General Public License version 2 only, as
553N/A * published by the Free Software Foundation. Oracle designates this
232N/A * particular file as subject to the "Classpath" exception as provided
553N/A * by Oracle in the LICENSE file that accompanied this code.
232N/A *
232N/A * This code is distributed in the hope that it will be useful, but WITHOUT
232N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
232N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
232N/A * version 2 for more details (a copy is included in the LICENSE file that
232N/A * accompanied this code).
232N/A *
232N/A * You should have received a copy of the GNU General Public License version
232N/A * 2 along with this work; if not, write to the Free Software Foundation,
232N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
232N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
232N/A */
232N/A
232N/A/*
232N/A * @test
243N/A * @bug 6786690 6820360
232N/A * @summary This test verifies the nesting of definition list tags.
232N/A * @author Bhavesh Patel
232N/A * @library ../lib/
957N/A * @build JavadocTester TestHtmlDefinitionListTag
232N/A * @run main TestHtmlDefinitionListTag
232N/A */
232N/A
232N/Apublic class TestHtmlDefinitionListTag extends JavadocTester {
232N/A
243N/A private static final String BUG_ID = "6786690-6820360";
232N/A
232N/A // Test common to all runs of javadoc. The class signature should print
232N/A // properly enclosed definition list tags and the Annotation Type
232N/A // Optional Element should print properly nested definition list tags
232N/A // for default value.
232N/A private static final String[][] TEST_ALL = {
957N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public class " +
957N/A "<span class=\"strong\">C1</span>" + NL +
765N/A "extends java.lang.Object" + NL + "implements java.io.Serializable</pre>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl>" + NL +
765N/A "<dt>Default:</dt>" + NL + "<dd>true</dd>" + NL +
765N/A "</dl>"}};
232N/A
232N/A // Test for normal run of javadoc in which various ClassDocs and
232N/A // serialized form should have properly nested definition list tags
232N/A // enclosing comments, tags and deprecated information.
232N/A private static final String[][] TEST_CMNT_DEPR = {
765N/A {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl>" +
765N/A "<dt><span class=\"strong\">Since:</span></dt>" + NL +
765N/A " <dd>JDK1.0</dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
765N/A " <dd>JDK1.0</dd>" + NL + "<dt><span class=\"strong\">See Also:</span></dt>" +
765N/A "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
765N/A "C2</code></a>, " + NL + "<a href=\"../serialized-form.html#pkg1.C1\">" +
765N/A "Serialized Form</a></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
765N/A " <dd>1.4</dd>" + NL +
765N/A "<dt><span class=\"strong\">See Also:</span></dt><dd>" +
765N/A "<a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:</span></dt><dd><code>title" +
765N/A "</code> - the title</dd><dd><code>test</code> - boolean value" +
765N/A "</dd>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL +
765N/A "<dd><code>java.lang.IllegalArgumentException</code> - if the " +
765N/A "<code>owner</code>'s" + NL +
765N/A " <code>GraphicsConfiguration</code> is not from a screen " +
765N/A "device</dd>" + NL + "<dd><code>HeadlessException</code></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:</span></dt><dd><code>undecorated" +
765N/A "</code> - <code>true</code> if no decorations are" + NL +
765N/A " to be enabled;" + NL + " <code>false</code> " +
765N/A "if decorations are to be enabled.</dd><dt><span class=\"strong\">Since:" +
765N/A "</span></dt>" + NL + " <dd>1.4</dd>" + NL +
765N/A "<dt><span class=\"strong\">See Also:</span></dt><dd>" +
765N/A "<a href=\"../pkg1/C1.html#readObject()\"><code>readObject()" +
765N/A "</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Throws:</span></dt>" + NL +
765N/A "<dd><code>java.io.IOException</code></dd><dt><span class=\"strong\">See Also:" +
765N/A "</span></dt><dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl><dt><span class=\"strong\">Parameters:" +
765N/A "</span></dt><dd><code>set</code> - boolean</dd><dt><span class=\"strong\">" +
765N/A "Since:</span></dt>" + NL + " <dd>1.4</dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<dl><dt><span class=\"strong\">Throws:</span>" +
765N/A "</dt>" + NL + "<dd><code>" +
765N/A "java.io.IOException</code></dd><dt><span class=\"strong\">See Also:</span>" +
765N/A "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
765N/A "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
765N/A " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
765N/A "<div class=\"block\">This field indicates whether the C1 is " +
765N/A "undecorated.</div>" + NL + "&nbsp;" + NL + "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
765N/A " <dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
765N/A "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
765N/A "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
765N/A " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
765N/A "<div class=\"block\">Reads the object stream.</div>" + NL +
765N/A "<dl><dt><span class=\"strong\">Throws:" +
765N/A "</span></dt>" + NL + "<dd><code><code>" +
765N/A "IOException</code></code></dd>" + NL +
765N/A "<dd><code>java.io.IOException</code></dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
765N/A "&nbsp;</div>" + NL +
765N/A "<div class=\"block\">The name for this class.</div>"}};
232N/A
232N/A // Test with -nodeprecated option. The ClassDocs should have properly nested
232N/A // definition list tags enclosing comments and tags. The ClassDocs should not
232N/A // display definition list for deprecated information. The serialized form
232N/A // should display properly nested definition list tags for comments, tags
232N/A // and deprecated information.
232N/A private static final String[][] TEST_NODEPR = {
765N/A {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl>" +
765N/A "<dt><span class=\"strong\">Since:</span></dt>" + NL +
765N/A " <dd>JDK1.0</dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Since:</span>" +
765N/A "</dt>" + NL + " <dd>JDK1.0</dd>" + NL + "<dt><span class=\"strong\">See Also:" +
765N/A "</span></dt><dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
765N/A "<code>C2</code></a>, " + NL + "<a href=\"../serialized-form.html#pkg1.C1\">" +
765N/A "Serialized Form</a></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:" +
765N/A "</span></dt><dd><code>title</code> - the title</dd><dd><code>" +
765N/A "test</code> - boolean value</dd>" + NL + "<dt><span class=\"strong\">Throws:" +
765N/A "</span></dt>" + NL + "<dd><code>java.lang.IllegalArgumentException" +
765N/A "</code> - if the <code>owner</code>'s" + NL + " <code>GraphicsConfiguration" +
765N/A "</code> is not from a screen device</dd>" + NL + "<dd><code>" +
765N/A "HeadlessException</code></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Parameters:" +
765N/A "</span></dt><dd><code>undecorated</code> - <code>true</code>" +
232N/A " if no decorations are" + NL + " to be enabled;" + NL +
232N/A " <code>false</code> if decorations are to be enabled." +
765N/A "</dd><dt><span class=\"strong\">Since:</span></dt>" + NL + " <dd>1.4</dd>" + NL +
765N/A "<dt><span class=\"strong\">See Also:</span></dt><dd><a href=\"../pkg1/C1.html#readObject()\">" +
765N/A "<code>readObject()</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl><dt><span class=\"strong\">Throws:</span>" +
765N/A "</dt>" + NL + "<dd><code>java.io.IOException</code></dd><dt>" +
765N/A "<span class=\"strong\">See Also:</span></dt><dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<dl><dt><span class=\"strong\">Throws:</span>" +
765N/A "</dt>" + NL + "<dd><code>" +
765N/A "java.io.IOException</code></dd><dt><span class=\"strong\">See Also:</span>" +
765N/A "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
765N/A "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
765N/A " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
765N/A "<div class=\"block\">This field indicates whether the C1 is " +
765N/A "undecorated.</div>" + NL + "&nbsp;" + NL + "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
765N/A " <dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
765N/A "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
765N/A "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
765N/A " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
765N/A "<div class=\"block\">Reads the object stream.</div>" + NL +
765N/A "<dl><dt><span class=\"strong\">Throws:" +
765N/A "</span></dt>" + NL + "<dd><code><code>" +
765N/A "IOException</code></code></dd>" + NL +
765N/A "<dd><code>java.io.IOException</code></dd></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
765N/A "&nbsp;</div>" + NL + "<div class=\"block\">" +
765N/A "The name for this class.</div>"}};
232N/A
232N/A // Test with -nocomment and -nodeprecated options. The ClassDocs whould
765N/A // not display definition lists for any member details.
232N/A private static final String[][] TEST_NOCMNT_NODEPR = {
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public&nbsp;void&nbsp;readObject()" + NL +
765N/A " throws java.io.IOException</pre>" + NL + "</li>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C2.html", "<pre>public&nbsp;C2()</pre>" + NL +
765N/A "</li>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<pre>public " +
765N/A "static final&nbsp;<a href=\"../pkg1/C1.ModalExclusionType.html\" " +
765N/A "title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
765N/A "APPLICATION_EXCLUDE</pre>" + NL + "</li>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<pre>boolean " +
765N/A "undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">" +
765N/A "Deprecated.</span>&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
765N/A " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
765N/A "setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
765N/A "Deprecated.</span>&nbsp;<i>As of JDK version" +
232N/A " 1.5, replaced by" + NL +
765N/A " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
765N/A "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"}};
232N/A
232N/A // Test for valid HTML generation which should not comprise of empty
232N/A // definition list tags.
232N/A private static final String[][] NEGATED_TEST = {
765N/A {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C2.ModalType.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C3.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C3.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C5.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "pkg1" + FS + "C5.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "overview-tree.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "overview-tree.html", "<dl>" + NL + "</dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<dl></dl>"},
765N/A {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "</dl>"}};
232N/A
232N/A private static final String[] ARGS1 =
232N/A new String[] {
232N/A "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
232N/A
232N/A private static final String[] ARGS2 =
232N/A new String[] {
232N/A "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
232N/A
232N/A private static final String[] ARGS3 =
232N/A new String[] {
232N/A "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
232N/A
232N/A private static final String[] ARGS4 =
232N/A new String[] {
232N/A "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
232N/A
232N/A /**
232N/A * The entry point of the test.
232N/A * @param args the array of command line arguments.
232N/A */
232N/A public static void main(String[] args) {
232N/A TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
388N/A tester.exactNewlineMatch = false;
232N/A run(tester, ARGS1, TEST_ALL, NEGATED_TEST);
232N/A run(tester, ARGS1, TEST_CMNT_DEPR, NEGATED_TEST);
232N/A run(tester, ARGS2, TEST_ALL, NEGATED_TEST);
765N/A run(tester, ARGS2, NO_TEST, TEST_CMNT_DEPR);
232N/A run(tester, ARGS3, TEST_ALL, NEGATED_TEST);
232N/A run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
232N/A run(tester, ARGS4, TEST_ALL, NEGATED_TEST);
232N/A run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
232N/A tester.printSummary();
232N/A }
232N/A
232N/A /**
232N/A * {@inheritDoc}
232N/A */
232N/A public String getBugId() {
232N/A return BUG_ID;
232N/A }
232N/A
232N/A /**
232N/A * {@inheritDoc}
232N/A */
232N/A public String getBugName() {
232N/A return getClass().getName();
232N/A }
232N/A}