1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Wed Apr 27 01:34:52 2016 +0800 1.3 @@ -0,0 +1,141 @@ 1.4 +/* 1.5 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +/* 1.30 + * @test 1.31 + * @bug 6802694 8025633 8026567 1.32 + * @summary This test verifies deprecation info in serialized-form.html. 1.33 + * @author Bhavesh Patel 1.34 + * @library ../lib/ 1.35 + * @build JavadocTester 1.36 + * @build TestSerializedFormDeprecationInfo 1.37 + * @run main TestSerializedFormDeprecationInfo 1.38 + */ 1.39 + 1.40 +public class TestSerializedFormDeprecationInfo extends JavadocTester { 1.41 + 1.42 + private static final String BUG_ID = "6802694"; 1.43 + 1.44 + // Test for normal run of javadoc. The serialized-form.html should 1.45 + // display the inline comments, tags and deprecation information if any. 1.46 + private static final String[][] TEST_CMNT_DEPR = { 1.47 + {BUG_ID + FS + "serialized-form.html", "<dl>" + NL + 1.48 + "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL + "<dd><code>" + 1.49 + "java.io.IOException</code></dd>"+ NL + "<dt><span class=\"seeLabel\">See Also:</span>" + 1.50 + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + 1.51 + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, 1.52 + {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" + 1.53 + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL + 1.54 + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + 1.55 + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + 1.56 + "<div class=\"block\">This field indicates whether the C1 " + 1.57 + "is undecorated.</div>" + NL + " " + NL + 1.58 + "<dl>" + NL + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>" + NL + 1.59 + "<dd>1.4</dd>" + NL + "<dt><span class=\"seeLabel\">See Also:</span>" + 1.60 + "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + 1.61 + "<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"}, 1.62 + {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" + 1.63 + " <span class=\"deprecationComment\">As of JDK version 1.5, replaced by" + NL + 1.64 + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + 1.65 + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + 1.66 + "<div class=\"block\">Reads the object stream.</div>" + NL + 1.67 + "<dl>" + NL + "<dt><span class=\"throwsLabel\">Throws:</span></dt>" + NL + "<dd><code><code>" + 1.68 + "IOException</code></code></dd>" + NL + 1.69 + "<dd><code>java.io.IOException</code></dd>" + NL + "</dl>"}, 1.70 + {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">Deprecated.</span>" + 1.71 + " </div>" + NL + "<div class=\"block\">" + 1.72 + "The name for this class.</div>"}}; 1.73 + 1.74 + // Test with -nocomment option. The serialized-form.html should 1.75 + // not display the inline comments and tags but should display deprecation 1.76 + // information if any. 1.77 + private static final String[][] TEST_NOCMNT = { 1.78 + {BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL + 1.79 + "<div class=\"block\"><span class=\"deprecatedLabel\">Deprecated.</span> <span class=\"deprecationComment\">" + 1.80 + "As of JDK version 1.5, replaced by" + NL + 1.81 + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" + 1.82 + "setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}, 1.83 + {BUG_ID + FS + "serialized-form.html", "<span class=\"deprecatedLabel\">" + 1.84 + "Deprecated.</span> <span class=\"deprecationComment\">As of JDK version" + 1.85 + " 1.5, replaced by" + NL + 1.86 + " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" + 1.87 + "<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}}; 1.88 + 1.89 + // Test with -nodeprecated option. The serialized-form.html should 1.90 + // ignore the -nodeprecated tag and display the deprecation info. This 1.91 + // test is similar to the normal run of javadoc in which inline comment, tags 1.92 + // and deprecation information will be displayed. 1.93 + private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR; 1.94 + 1.95 + // Test with -nodeprecated and -nocomment options. The serialized-form.html should 1.96 + // ignore the -nodeprecated tag and display the deprecation info but should not 1.97 + // display the inline comments and tags. This test is similar to the test with 1.98 + // -nocomment option. 1.99 + private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT; 1.100 + 1.101 + private static final String[] ARGS1 = 1.102 + new String[] { 1.103 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"}; 1.104 + 1.105 + private static final String[] ARGS2 = 1.106 + new String[] { 1.107 + "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"}; 1.108 + 1.109 + private static final String[] ARGS3 = 1.110 + new String[] { 1.111 + "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"}; 1.112 + 1.113 + private static final String[] ARGS4 = 1.114 + new String[] { 1.115 + "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"}; 1.116 + 1.117 + /** 1.118 + * The entry point of the test. 1.119 + * @param args the array of command line arguments. 1.120 + */ 1.121 + public static void main(String[] args) { 1.122 + TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo(); 1.123 + tester.exactNewlineMatch = false; 1.124 + run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT); 1.125 + run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR); 1.126 + run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR); 1.127 + run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR); 1.128 + tester.printSummary(); 1.129 + } 1.130 + 1.131 + /** 1.132 + * {@inheritDoc} 1.133 + */ 1.134 + public String getBugId() { 1.135 + return BUG_ID; 1.136 + } 1.137 + 1.138 + /** 1.139 + * {@inheritDoc} 1.140 + */ 1.141 + public String getBugName() { 1.142 + return getClass().getName(); 1.143 + } 1.144 +}