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