/* * Copyright (c) 2009, 2015, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 6786690 6820360 8025633 8026567 * @summary This test verifies the nesting of definition list tags. * @author Bhavesh Patel * @library ../lib * @modules jdk.javadoc * @build JavadocTester * @run main TestHtmlDefinitionListTag */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class TestHtmlDefinitionListTag extends JavadocTester { 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, "
public class C1\n" +
                "extends java.lang.Object\n" +
                "implements java.io.Serializable
"); checkOutput("pkg1/C4.html", true, "
\n" + "
Default:
\n" + "
true
\n" + "
"); // Test for valid HTML generation which should not comprise of empty // definition list tags. List 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, "
", "
\n
"); } } 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, "
\n" + "
Since:
\n" + "
JDK1.0
\n" + "
"); checkOutput("pkg1/C1.html", expectFound, "
\n" + "
Since:
\n" + "
JDK1.0
\n" + "
See Also:
\n" + "
" + "C2, \n" + "" + "Serialized Form
\n" + "
", "
\n" + "
Since:
\n" + "
1.4
\n" + "
See Also:
\n" + "
" + "setUndecorated(boolean)
\n" + "
", "
\n" + "
Parameters:
\n" + "
title - the title
\n" + "
test - boolean value" + "
\n" + "
Throws:
\n" + "
java.lang.IllegalArgumentException - if the " + "owner's\n" + " GraphicsConfiguration is not from a screen " + "device
\n" + "
HeadlessException
\n" + "
", "
\n" + "
Parameters:
\n" + "
undecorated" + " - true if no decorations are\n" + " to be enabled;\n" + " false " + "if decorations are to be enabled.
\n" + "
Since:" + "
\n" + "
1.4
\n" + "
See Also:
\n" + "
" + "readObject()" + "
\n" + "
", "
\n" + "
Throws:
\n" + "
java.io.IOException
\n" + "
See Also:" + "
\n" + "
" + "setUndecorated(boolean)
\n" + "
"); checkOutput("pkg1/C2.html", expectFound, "
\n" + "
Parameters:" + "
\n" + "
set - boolean
\n" + "
" + "Since:
\n" + "
1.4
\n" + "
"); checkOutput("serialized-form.html", expectFound, "
\n" + "
Throws:" + "
\n" + "
" + "java.io.IOException
\n" + "
See Also:" + "
\n" + "
" + "C1.setUndecorated(boolean)
\n" + "
", "Deprecated." + " As of JDK version 1.5, replaced by\n" + " " + "setUndecorated(boolean).\n" + "
This field indicates whether the C1 is " + "undecorated.
\n" + " \n" + "
\n" + "
Since:
\n" + "
1.4
\n" + "
See Also:" + "
\n" + "
" + "C1.setUndecorated(boolean)
\n" + "
", "Deprecated." + " As of JDK version 1.5, replaced by\n" + " " + "setUndecorated(boolean).\n" + "
Reads the object stream.
\n" + "
\n" + "
Throws:" + "
\n" + "
java.io.IOException
\n" + "
", "Deprecated." + " \n" + "
The name for this class.
"); } 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, "
\n" + "
Since:
\n" + "
JDK1.0
\n" + "
"); checkOutput("pkg1/C1.html", true, "
\n" + "
Since:" + "
\n" + "
JDK1.0
\n" + "
See Also:" + "
\n" + "
" + "C2, \n" + "" + "Serialized Form
\n" + "
"); checkOutput("pkg1/C1.html", true, "
\n" + "
Parameters:" + "
\n" + "
title - the title
\n" + "
" + "test - boolean value
\n" + "
Throws:" + "
\n" + "
java.lang.IllegalArgumentException" + " - if the owner's\n" + " GraphicsConfiguration" + " is not from a screen device
\n" + "
" + "HeadlessException
\n" + "
", "
\n" + "
Parameters:" + "
\n" + "
undecorated - true" + " if no decorations are\n" + " to be enabled;\n" + " false if decorations are to be enabled." + "
\n" + "
Since:
\n" + "
1.4
\n" + "
See Also:
\n" + "
" + "readObject()
\n" + "
", "
\n" + "
Throws:" + "
\n" + "
java.io.IOException
\n" + "
" + "See Also:
\n" + "
" + "setUndecorated(boolean)
\n" + "
"); checkOutput("serialized-form.html", true, "
\n" + "
Throws:" + "
\n" + "
" + "java.io.IOException
\n" + "
See Also:" + "
\n" + "
" + "C1.setUndecorated(boolean)
\n" + "
", "Deprecated." + " As of JDK version 1.5, replaced by\n" + " " + "setUndecorated(boolean).\n" + "
This field indicates whether the C1 is " + "undecorated.
\n" + " \n" + "
\n" + "
Since:
\n" + "
1.4
\n" + "
See Also:" + "
\n" + "
" + "C1.setUndecorated(boolean)
\n" + "
", "Deprecated." + " As of JDK version 1.5, replaced by\n" + " " + "setUndecorated(boolean).\n" + "
Reads the object stream.
\n" + "
\n" + "
Throws:" + "
\n" + "
java.io.IOException
\n" + "
", "Deprecated." + " \n" + "
" + "The name for this class.
"); } 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, "
public void readObject()\n" +
                "                throws java.io.IOException
\n" + ""); checkOutput("pkg1/C2.html", expectFound, "
public C2()
\n" + ""); checkOutput("pkg1/C1.ModalExclusionType.html", expectFound, "
public " +
                "static final C1.ModalExclusionType " +
                "APPLICATION_EXCLUDE
\n" + ""); checkOutput("serialized-form.html", expectFound, "
boolean " +
                "undecorated
\n" + "
" + "Deprecated. As of JDK version 1.5, replaced by\n" + " " + "setUndecorated(boolean).
\n" + "", "" + "Deprecated. As of JDK version" + " 1.5, replaced by\n" + " " + "setUndecorated(boolean).\n" + ""); } }