test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java

Wed, 01 Dec 2010 11:02:38 -0800

author
bpatel
date
Wed, 01 Dec 2010 11:02:38 -0800
changeset 766
90af8d87741f
parent 554
9d9f26857129
child 798
4868a36f6fd8
permissions
-rw-r--r--

6851834: Javadoc doclet needs a structured approach to generate the output HTML.
Reviewed-by: jjg

bpatel@222 1 /*
ohair@554 2 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
bpatel@222 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bpatel@222 4 *
bpatel@222 5 * This code is free software; you can redistribute it and/or modify it
bpatel@222 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
bpatel@222 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
bpatel@222 10 *
bpatel@222 11 * This code is distributed in the hope that it will be useful, but WITHOUT
bpatel@222 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bpatel@222 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bpatel@222 14 * version 2 for more details (a copy is included in the LICENSE file that
bpatel@222 15 * accompanied this code).
bpatel@222 16 *
bpatel@222 17 * You should have received a copy of the GNU General Public License version
bpatel@222 18 * 2 along with this work; if not, write to the Free Software Foundation,
bpatel@222 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bpatel@222 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
bpatel@222 24 */
bpatel@222 25
bpatel@222 26 /*
bpatel@222 27 * @test
bpatel@222 28 * @bug 6802694
bpatel@222 29 * @summary This test verifies deprecation info in serialized-form.html.
bpatel@222 30 * @author Bhavesh Patel
bpatel@222 31 * @library ../lib/
bpatel@222 32 * @build JavadocTester
bpatel@222 33 * @build TestSerializedFormDeprecationInfo
bpatel@222 34 * @run main TestSerializedFormDeprecationInfo
bpatel@222 35 */
bpatel@222 36
bpatel@222 37 public class TestSerializedFormDeprecationInfo extends JavadocTester {
bpatel@222 38
bpatel@222 39 private static final String BUG_ID = "6802694";
bpatel@222 40
bpatel@222 41 // Test for normal run of javadoc. The serialized-form.html should
bpatel@222 42 // display the inline comments, tags and deprecation information if any.
bpatel@222 43 private static final String[][] TEST_CMNT_DEPR = {
bpatel@766 44 {BUG_ID + FS + "serialized-form.html", "<dl>" +
bpatel@766 45 "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" +
bpatel@766 46 "java.io.IOException</code></dd><dt><span class=\"strong\">See Also:</span>" +
bpatel@766 47 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
bpatel@766 48 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
bpatel@766 49 {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
bpatel@766 50 "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
bpatel@766 51 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
bpatel@766 52 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
bpatel@766 53 "<div class=\"block\">This field indicates whether the C1 " +
bpatel@766 54 "is undecorated.</div>" + NL + "&nbsp;" + NL +
bpatel@766 55 "<dl><dt><span class=\"strong\">Since:</span></dt>" + NL +
bpatel@766 56 " <dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
bpatel@766 57 "</dt><dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
bpatel@766 58 "<code>C1.setUndecorated(boolean)</code></a></dd></dl>"},
bpatel@766 59 {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
bpatel@766 60 "&nbsp;<i>As of JDK version 1.5, replaced by" + NL +
bpatel@766 61 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
bpatel@766 62 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL +
bpatel@766 63 "<div class=\"block\">Reads the object stream.</div>" + NL +
bpatel@766 64 "<dl><dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" +
bpatel@766 65 "IOException</code></code></dd>" + NL +
bpatel@766 66 "<dd><code>java.io.IOException</code></dd></dl>"},
bpatel@766 67 {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
bpatel@766 68 "&nbsp;</div>" + NL + "<div class=\"block\">" +
bpatel@766 69 "The name for this class.</div>"}};
bpatel@222 70
bpatel@222 71 // Test with -nocomment option. The serialized-form.html should
bpatel@222 72 // not display the inline comments and tags but should display deprecation
bpatel@222 73 // information if any.
bpatel@222 74 private static final String[][] TEST_NOCMNT = {
bpatel@766 75 {BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL +
bpatel@766 76 "<div class=\"block\"><span class=\"strong\">Deprecated.</span>&nbsp;<i>" +
bpatel@766 77 "As of JDK version 1.5, replaced by" + NL +
bpatel@766 78 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
bpatel@766 79 "setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"},
bpatel@766 80 {BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
bpatel@766 81 "Deprecated.</span>&nbsp;<i>As of JDK version" +
bpatel@222 82 " 1.5, replaced by" + NL +
bpatel@766 83 " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
bpatel@766 84 "<code>setUndecorated(boolean)</code></a>.</i></div>" + NL + "</li>"}};
bpatel@222 85
bpatel@222 86 // Test with -nodeprecated option. The serialized-form.html should
bpatel@222 87 // ignore the -nodeprecated tag and display the deprecation info. This
bpatel@222 88 // test is similar to the normal run of javadoc in which inline comment, tags
bpatel@222 89 // and deprecation information will be displayed.
bpatel@222 90 private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
bpatel@222 91
bpatel@222 92 // Test with -nodeprecated and -nocomment options. The serialized-form.html should
bpatel@222 93 // ignore the -nodeprecated tag and display the deprecation info but should not
bpatel@222 94 // display the inline comments and tags. This test is similar to the test with
bpatel@222 95 // -nocomment option.
bpatel@222 96 private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
bpatel@222 97
bpatel@222 98 private static final String[] ARGS1 =
bpatel@222 99 new String[] {
bpatel@222 100 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
bpatel@222 101
bpatel@222 102 private static final String[] ARGS2 =
bpatel@222 103 new String[] {
bpatel@222 104 "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
bpatel@222 105
bpatel@222 106 private static final String[] ARGS3 =
bpatel@222 107 new String[] {
bpatel@222 108 "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
bpatel@222 109
bpatel@222 110 private static final String[] ARGS4 =
bpatel@222 111 new String[] {
bpatel@222 112 "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
bpatel@222 113
bpatel@222 114 /**
bpatel@222 115 * The entry point of the test.
bpatel@222 116 * @param args the array of command line arguments.
bpatel@222 117 */
bpatel@222 118 public static void main(String[] args) {
bpatel@222 119 TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
jjg@389 120 tester.exactNewlineMatch = false;
bpatel@222 121 run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
bpatel@222 122 run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
bpatel@222 123 run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
bpatel@222 124 run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
bpatel@222 125 tester.printSummary();
bpatel@222 126 }
bpatel@222 127
bpatel@222 128 /**
bpatel@222 129 * {@inheritDoc}
bpatel@222 130 */
bpatel@222 131 public String getBugId() {
bpatel@222 132 return BUG_ID;
bpatel@222 133 }
bpatel@222 134
bpatel@222 135 /**
bpatel@222 136 * {@inheritDoc}
bpatel@222 137 */
bpatel@222 138 public String getBugName() {
bpatel@222 139 return getClass().getName();
bpatel@222 140 }
bpatel@222 141 }

mercurial