TestSerializedFormDeprecationInfo.java revision 553
221N/A/*
553N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
221N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
221N/A *
221N/A * This code is free software; you can redistribute it and/or modify it
221N/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
221N/A * particular file as subject to the "Classpath" exception as provided
553N/A * by Oracle in the LICENSE file that accompanied this code.
221N/A *
221N/A * This code is distributed in the hope that it will be useful, but WITHOUT
221N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
221N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
221N/A * version 2 for more details (a copy is included in the LICENSE file that
221N/A * accompanied this code).
221N/A *
221N/A * You should have received a copy of the GNU General Public License version
221N/A * 2 along with this work; if not, write to the Free Software Foundation,
221N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
221N/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.
221N/A */
221N/A
221N/A/*
221N/A * @test
221N/A * @bug 6802694
221N/A * @summary This test verifies deprecation info in serialized-form.html.
221N/A * @author Bhavesh Patel
221N/A * @library ../lib/
221N/A * @build JavadocTester
221N/A * @build TestSerializedFormDeprecationInfo
221N/A * @run main TestSerializedFormDeprecationInfo
221N/A */
221N/A
221N/Apublic class TestSerializedFormDeprecationInfo extends JavadocTester {
221N/A
221N/A private static final String BUG_ID = "6802694";
221N/A
221N/A // Test for normal run of javadoc. The serialized-form.html should
221N/A // display the inline comments, tags and deprecation information if any.
221N/A private static final String[][] TEST_CMNT_DEPR = {
232N/A {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><DL>" + NL +
232N/A "<DT><STRONG>Throws:</STRONG></DT>" + NL + "<DD><CODE>" +
232N/A "java.io.IOException</CODE></DD><DT><STRONG>See Also:</STRONG>" +
232N/A "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
232N/A "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
232N/A "</DD>" + NL + "</DL>"},
221N/A {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
232N/A "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version " +
232N/A "1.5, replaced by" + NL +
221N/A " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
232N/A "<CODE>setUndecorated(boolean)</CODE></A>.</I></DD>" +
221N/A "<DD>This field indicates whether the C1 is undecorated." + NL +
232N/A "<P>" + NL + "</DD>" + NL + "<DD>&nbsp;</DD>" + NL +
232N/A "<DD><DL>" + NL + "<DT><STRONG>Since:</STRONG></DT>" + NL +
221N/A " <DD>1.4</DD>" + NL + "<DT><STRONG>See Also:</STRONG>" +
232N/A "</DT><DD><A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
232N/A "<CODE>C1.setUndecorated(boolean)</CODE></A></DD></DL>" + NL +
232N/A "</DD>" + NL + "</DL>"},
221N/A {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
221N/A "<DD><STRONG>Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
221N/A " 1.5, replaced by" + NL +
221N/A " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
221N/A "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
232N/A "</DD><DD>Reads the object stream." + NL + "<P>" + NL +
232N/A "</DD>" + NL + "<DD><DL>" + NL + "<DT><STRONG>Throws:" +
232N/A "</STRONG></DT>" + NL + "<DD><CODE><code>" +
232N/A "IOException</code></CODE></DD>" + NL +
232N/A "<DD><CODE>java.io.IOException</CODE></DD></DL>" + NL +
232N/A "</DD>" + NL + "</DL>"},
221N/A {BUG_ID + FS + "serialized-form.html", "<DL>" + NL +
232N/A "<DD><STRONG>Deprecated.</STRONG>&nbsp;</DD><DD>" +
232N/A "The name for this class." + NL + "<P>" + NL + "</DD>" + NL +
232N/A "<DD>&nbsp;</DD>" + NL + "</DL>"}};
221N/A
221N/A // Test with -nocomment option. The serialized-form.html should
221N/A // not display the inline comments and tags but should display deprecation
221N/A // information if any.
221N/A private static final String[][] TEST_NOCMNT = {
221N/A {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "boolean <STRONG>" +
221N/A "undecorated</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
221N/A "Deprecated.</STRONG>&nbsp;<I>As of JDK version 1.5, replaced by" + NL +
221N/A " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\"><CODE>" +
232N/A "setUndecorated(boolean)</CODE></A>.</I></DD></DL>"},
221N/A {BUG_ID + FS + "serialized-form.html", "<DL>" + NL + "<DD><STRONG>" +
221N/A "Deprecated.</STRONG>&nbsp;<I>As of JDK version" +
221N/A " 1.5, replaced by" + NL +
221N/A " <A HREF=\"pkg1/C1.html#setUndecorated(boolean)\">" +
221N/A "<CODE>setUndecorated(boolean)</CODE></A>.</I>" + NL + "<P>" + NL +
232N/A "</DD></DL>"},
221N/A {BUG_ID + FS + "serialized-form.html", "<PRE>" + NL + "int <STRONG>" +
221N/A "publicKey</STRONG></PRE>" + NL + "<DL>" + NL + "<DD><STRONG>" +
232N/A "Deprecated.</STRONG>&nbsp;</DD></DL>"}};
221N/A
221N/A // Test with -nodeprecated option. The serialized-form.html should
221N/A // ignore the -nodeprecated tag and display the deprecation info. This
221N/A // test is similar to the normal run of javadoc in which inline comment, tags
221N/A // and deprecation information will be displayed.
221N/A private static final String[][] TEST_NODEPR = TEST_CMNT_DEPR;
221N/A
221N/A // Test with -nodeprecated and -nocomment options. The serialized-form.html should
221N/A // ignore the -nodeprecated tag and display the deprecation info but should not
221N/A // display the inline comments and tags. This test is similar to the test with
221N/A // -nocomment option.
221N/A private static final String[][] TEST_NOCMNT_NODEPR = TEST_NOCMNT;
221N/A
221N/A private static final String[] ARGS1 =
221N/A new String[] {
221N/A "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
221N/A
221N/A private static final String[] ARGS2 =
221N/A new String[] {
221N/A "-d", BUG_ID, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
221N/A
221N/A private static final String[] ARGS3 =
221N/A new String[] {
221N/A "-d", BUG_ID, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
221N/A
221N/A private static final String[] ARGS4 =
221N/A new String[] {
221N/A "-d", BUG_ID, "-nocomment", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
221N/A
221N/A /**
221N/A * The entry point of the test.
221N/A * @param args the array of command line arguments.
221N/A */
221N/A public static void main(String[] args) {
221N/A TestSerializedFormDeprecationInfo tester = new TestSerializedFormDeprecationInfo();
388N/A tester.exactNewlineMatch = false;
221N/A run(tester, ARGS1, TEST_CMNT_DEPR, TEST_NOCMNT);
221N/A run(tester, ARGS2, TEST_NOCMNT, TEST_CMNT_DEPR);
221N/A run(tester, ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
221N/A run(tester, ARGS4, TEST_NOCMNT_NODEPR, TEST_NODEPR);
221N/A tester.printSummary();
221N/A }
221N/A
221N/A /**
221N/A * {@inheritDoc}
221N/A */
221N/A public String getBugId() {
221N/A return BUG_ID;
221N/A }
221N/A
221N/A /**
221N/A * {@inheritDoc}
221N/A */
221N/A public String getBugName() {
221N/A return getClass().getName();
221N/A }
221N/A}