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

Tue, 14 May 2013 10:14:54 -0700

author
jjg
date
Tue, 14 May 2013 10:14:54 -0700
changeset 1743
6a5288a298fd
parent 1490
fc4cb1577ad6
child 2062
9e884d3ddb0b
permissions
-rw-r--r--

8012175: Convert TagletOutputImpl to use ContentBuilder instead of StringBuilder
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 2003, 2013, 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             "-Xdoclint:none",
    45             "-d", BUG_ID, "-sourcepath", SRC_DIR, "-tag",
    46             "todo", "pkg1", "pkg2"
    47         };
    49     //Input for string search tests.
    50     private static final String[][] TEST = {
    51         //Base case:  using @value on a constant.
    52         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    53             "Result:  \"Test 1 passes\""},
    54         //Retrieve value of constant in same class.
    55         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    56             "Result:  <a href=\"../pkg1/Class1.html#TEST_2_PASSES\">\"Test 2 passes\"</a>"},
    57         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    58             "Result:  <a href=\"../pkg1/Class1.html#TEST_3_PASSES\">\"Test 3 passes\"</a>"},
    59         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    60             "Result:  <a href=\"../pkg1/Class1.html#TEST_4_PASSES\">\"Test 4 passes\"</a>"},
    61         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    62             "Result:  <a href=\"../pkg1/Class1.html#TEST_5_PASSES\">\"Test 5 passes\"</a>"},
    63         {BUG_ID + FS + "pkg1" + FS + "Class1.html",
    64             "Result:  <a href=\"../pkg1/Class1.html#TEST_6_PASSES\">\"Test 6 passes\"</a>"},
    65         //Retrieve value of constant in different class.
    66         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    67             "Result:  <a href=\"../pkg1/Class1.html#TEST_7_PASSES\">\"Test 7 passes\"</a>"},
    68         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    69             "Result:  <a href=\"../pkg1/Class1.html#TEST_8_PASSES\">\"Test 8 passes\"</a>"},
    70         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    71             "Result:  <a href=\"../pkg1/Class1.html#TEST_9_PASSES\">\"Test 9 passes\"</a>"},
    72         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    73             "Result:  <a href=\"../pkg1/Class1.html#TEST_10_PASSES\">\"Test 10 passes\"</a>"},
    74         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    75             "Result:  <a href=\"../pkg1/Class1.html#TEST_11_PASSES\">\"Test 11 passes\"</a>"},
    76         //Retrieve value of constant in different package
    77         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    78             "Result:  <a href=\"../pkg2/Class3.html#TEST_12_PASSES\">\"Test 12 passes\"</a>"},
    79         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    80             "Result:  <a href=\"../pkg2/Class3.html#TEST_13_PASSES\">\"Test 13 passes\"</a>"},
    81         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    82             "Result:  <a href=\"../pkg2/Class3.html#TEST_14_PASSES\">\"Test 14 passes\"</a>"},
    83         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    84             "Result:  <a href=\"../pkg2/Class3.html#TEST_15_PASSES\">\"Test 15 passes\"</a>"},
    85         {BUG_ID + FS + "pkg1" + FS + "Class2.html",
    86             "Result:  <a href=\"../pkg2/Class3.html#TEST_16_PASSES\">\"Test 16 passes\"</a>"},
    87         //Retrieve value of constant from a package page
    88         {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
    89             "Result: <a href=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</a>"},
    90         //Test @value tag used with custom tag.
    91         {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html",
    92             "<dt><span class=\"strong\">Todo:</span></dt>" + NL +
    93                 "<dd>the value of this constant is 55.</dd>"},
    94         //Test @value warning printed when used with non-constant.
    95         {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " +
    96             "can only be used in constants."
    97         },
    98         //Test warning printed for bad reference.
    99         {WARNING_OUTPUT,"warning - UnknownClass#unknownConstant (referenced by " +
   100             "@value tag) is an unknown reference."
   101         },
   102     };
   103     private static final String[][] NEGATED_TEST = NO_TEST;
   105     /**
   106      * The entry point of the test.
   107      * @param args the array of command line arguments.
   108      */
   109     public static void main(String[] args) {
   110         TestValueTag tester = new TestValueTag();
   111         run(tester, ARGS, TEST, NEGATED_TEST);
   112         tester.printSummary();
   113     }
   115     /**
   116      * {@inheritDoc}
   117      */
   118     public String getBugId() {
   119         return BUG_ID;
   120     }
   122     /**
   123      * {@inheritDoc}
   124      */
   125     public String getBugName() {
   126         return getClass().getName();
   127     }
   128 }

mercurial