test/com/sun/javadoc/testValueTag/TestValueTag.java

Wed, 28 Nov 2012 14:07:26 -0800

author
katleman
date
Wed, 28 Nov 2012 14:07:26 -0800
changeset 1425
20230f8b0eef
parent 798
4868a36f6fd8
child 1490
fc4cb1577ad6
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  */
    24 /*
    25  * @test
    26  * @bug      4764045
    27  * @summary  This test ensures that the value tag works in all
    28  * use cases. The explainations for each test case are written below.
    29  * @author   jamieh
    30  * @library  ../lib/
    31  * @build    JavadocTester
    32  * @build    TestValueTag
    33  * @run main TestValueTag
    34  */
    36 public class TestValueTag extends JavadocTester {
    38     //Test information.
    39     private static final String BUG_ID = "4764045";
    41     //Javadoc arguments.
    42     private static final String[] ARGS =
    43         new String[] {
    44             "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
    45             "todo", "pkg1", "pkg2"
    46         };
    48     //Input for string search tests.
    49     private static final String[][] TEST = {
    50         //Base case:  using @value on a constant.
    51         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    52             "Result:  \"Test 1 passes\""},
    53         //Retrieve value of constant in same class.
    54         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    55             "Result:  <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
    56         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    57             "Result:  <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
    58         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    59             "Result:  <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
    60         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    61             "Result:  <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
    62         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    63             "Result:  <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
    64         //Retrieve value of constant in different class.
    65         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    66             "Result:  <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
    67         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    68             "Result:  <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
    69         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    70             "Result:  <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
    71         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    72             "Result:  <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
    73         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    74             "Result:  <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
    75         //Retrieve value of constant in different package
    76         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    77             "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
    78         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    79             "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
    80         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    81             "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
    82         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    83             "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
    84         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    85             "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
    86         //Retrieve value of constant from a package page
    87         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
    88             "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
    89         //Test @value tag used with custom tag.
    90         {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
    91             "<dt><span class=\"strong\">Todo:</span></dt>" + NL +
    92                 "  <dd>the value of this constant is 55.</dd>"},
    93         //Test @value warning printed when used with non-constant.
    94         {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +
    95             "can only be used in constants."
    96         },
    97         //Test warning printed for bad reference.
    98         {WARNING_OUTPUT,"warning - UnknownClass#unknownConstant (referenced by " +
    99             "@value tag) is an unknown reference."
   100         },
   101     };
   102     private static final String[][] NEGATED_TEST = NO_TEST;
   104     /**
   105      * The entry point of the test.
   106      * @param args the array of command line arguments.
   107      */
   108     public static void main(String[] args) {
   109         TestValueTag tester = new TestValueTag();
   110         run(tester, ARGS, TEST, NEGATED_TEST);
   111         tester.printSummary();
   112     }
   114     /**
   115      * {@inheritDoc}
   116      */
   117     public String getBugId() {
   118         return BUG_ID;
   119     }
   121     /**
   122      * {@inheritDoc}
   123      */
   124     public String getBugName() {
   125         return getClass().getName();
   126     }
   127 }

mercurial