0N/A/*
797N/A * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/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.
0N/A */
0N/A
0N/A/*
0N/A * @test
0N/A * @bug 4764045
0N/A * @summary This test ensures that the value tag works in all
0N/A * use cases. The explainations for each test case are written below.
0N/A * @author jamieh
0N/A * @library ../lib/
0N/A * @build JavadocTester
0N/A * @build TestValueTag
0N/A * @run main TestValueTag
0N/A */
0N/A
0N/Apublic class TestValueTag extends JavadocTester {
0N/A
0N/A //Test information.
0N/A private static final String BUG_ID = "4764045";
0N/A
0N/A //Javadoc arguments.
0N/A private static final String[] ARGS =
0N/A new String[] {
0N/A "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
0N/A "todo", "pkg1", "pkg2"
0N/A };
0N/A
0N/A //Input for string search tests.
0N/A private static final String[][] TEST = {
0N/A //Base case: using @value on a constant.
0N/A {BUG_ID + FS + "pkg1" + FS + "Class1.html",
0N/A "Result: \"Test 1 passes\""},
0N/A //Retrieve value of constant in same class.
0N/A {BUG_ID + FS + "pkg1" + FS + "Class1.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class1.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class1.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class1.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class1.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
0N/A //Retrieve value of constant in different class.
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
0N/A //Retrieve value of constant in different package
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
0N/A {BUG_ID + FS + "pkg1" + FS + "Class2.html",
765N/A "Result: <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
0N/A //Retrieve value of constant from a package page
0N/A {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
765N/A "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
0N/A //Test @value tag used with custom tag.
0N/A {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
765N/A "<dt><span class=\"strong\">Todo:</span></dt>" + NL +
765N/A " <dd>the value of this constant is 55.</dd>"},
0N/A //Test @value warning printed when used with non-constant.
0N/A {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +
0N/A "can only be used in constants."
0N/A },
0N/A //Test warning printed for bad reference.
0N/A {WARNING_OUTPUT,"warning - UnknownClass#unknownConstant (referenced by " +
0N/A "@value tag) is an unknown reference."
0N/A },
0N/A };
0N/A private static final String[][] NEGATED_TEST = NO_TEST;
0N/A
0N/A /**
0N/A * The entry point of the test.
0N/A * @param args the array of command line arguments.
0N/A */
0N/A public static void main(String[] args) {
0N/A TestValueTag tester = new TestValueTag();
0N/A run(tester, ARGS, TEST, NEGATED_TEST);
0N/A tester.printSummary();
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public String getBugId() {
0N/A return BUG_ID;
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public String getBugName() {
0N/A return getClass().getName();
0N/A }
0N/A}