test/com/sun/javadoc/testHref/TestHref.java

Tue, 28 Dec 2010 15:54:52 -0800

author
ohair
date
Tue, 28 Dec 2010 15:54:52 -0800
changeset 798
4868a36f6fd8
parent 766
90af8d87741f
child 958
734144b6b22f
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

     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      4663254
    27  * @summary  Verify that spaces do not appear in hrefs and anchors.
    28  * @author   jamieh
    29  * @library  ../lib/
    30  * @build    JavadocTester
    31  * @build    TestHref
    32  * @run main TestHref
    33  */
    35 public class TestHref extends JavadocTester {
    37     //Test information.
    38     private static final String BUG_ID = "4663254";
    40     //Javadoc arguments.
    41     private static final String[] ARGS = new String[] {
    42         "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR, "-linkoffline",
    43         "http://java.sun.com/j2se/1.4/docs/api/", SRC_DIR, "pkg"
    44     };
    46     //Input for string search tests.
    47     private static final String[][] TEST = {
    48         //External link.
    49         {BUG_ID + FS + "pkg" + FS + "C1.html",
    50             "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long, int)\""
    51         },
    52         //Member summary table link.
    53         {BUG_ID + FS + "pkg" + FS + "C1.html",
    54             "href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\""
    55         },
    56         //Anchor test.
    57         {BUG_ID + FS + "pkg" + FS + "C1.html",
    58             "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
    59             "<!--   -->" + NL +
    60             "</a>"
    61         },
    62         //Backward compatibility anchor test.
    63         {BUG_ID + FS + "pkg" + FS + "C1.html",
    64             "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
    65             "<!--   -->" + NL +
    66             "</a>"
    67         },
    68         //{@link} test.
    69         {BUG_ID + FS + "pkg" + FS + "C2.html",
    70             "Link: <a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
    71         },
    72         //@see test.
    73         {BUG_ID + FS + "pkg" + FS + "C2.html",
    74             "See Also:</span></dt><dd><a href=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">"
    75         },
    77         //Header does not link to the page itself.
    78         {BUG_ID + FS + "pkg" + FS + "C4.html",
    79             "Class C4&lt;E extends C4&lt;E&gt;&gt;</h2>"
    80         },
    82         //Signature does not link to the page itself.
    83         {BUG_ID + FS + "pkg" + FS + "C4.html",
    84             "public abstract class <strong>C4&lt;E extends C4&lt;E&gt;&gt;</strong>"
    85         },
    86     };
    87     private static final String[][] NEGATED_TEST =
    88     {
    89         {WARNING_OUTPUT,  "<a> tag is malformed"}
    90     };
    92     /**
    93      * The entry point of the test.
    94      * @param args the array of command line arguments.
    95      */
    96     public static void main(String[] args) {
    97         TestHref tester = new TestHref();
    98         run(tester, ARGS, TEST, NEGATED_TEST);
    99         tester.printSummary();
   100     }
   102     /**
   103      * {@inheritDoc}
   104      */
   105     public String getBugId() {
   106         return BUG_ID;
   107     }
   109     /**
   110      * {@inheritDoc}
   111      */
   112     public String getBugName() {
   113         return getClass().getName();
   114     }
   115 }

mercurial