TestLinkTaglet.java revision 2054:184c0d6698c3
1/* 2 * Copyright (c) 2004, 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 */ 23 24/* 25 * @test 26 * @bug 4732864 6280605 7064544 8014636 8016328 27 * @summary Make sure that you can link from one member to another using 28 * non-qualified name, furthermore, ensure the right one is linked. 29 * @author jamieh 30 * @library ../lib/ 31 * @build JavadocTester 32 * @build TestLinkTaglet 33 * @run main TestLinkTaglet 34 */ 35 36public class TestLinkTaglet extends JavadocTester { 37 38 //Test information. 39 private static final String BUG_ID = "4732864-6280605-7064544-8014636"; 40 41 //Javadoc arguments. 42 private static final String[] ARGS = new String[] { 43 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", SRC_DIR + FS + "checkPkg" + FS + "B.java" 44 }; 45 46 //Input for string search tests. 47 private static final String[][] TEST = { 48 {BUG_ID + FS + "pkg" + FS + "C.html", 49 "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + 50 " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + 51 " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + 52 " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL + 53 " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL + 54 " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>" 55 }, 56 {BUG_ID + FS + "pkg" + FS + "C.InnerC.html", 57 "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL + 58 " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>" + NL + 59 " Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>" 60 }, 61 {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html", 62 "<dl>" + NL + "<dt>Enclosing class:</dt>" + NL + 63 "<dd><a href=\"../pkg/C.html\" title=\"class in pkg\">C</a></dd>" + NL + 64 "</dl>" 65 }, 66 }; 67 private static final String[][] NEGATED_TEST = { 68 {WARNING_OUTPUT, "Tag @see: reference not found: A"}, 69 }; 70 71 /** 72 * The entry point of the test. 73 * @param args the array of command line arguments. 74 */ 75 public static void main(String[] args) { 76 TestLinkTaglet tester = new TestLinkTaglet(); 77 run(tester, ARGS, TEST, NEGATED_TEST); 78 tester.printSummary(); 79 } 80 81 /** 82 * {@inheritDoc} 83 */ 84 public String getBugId() { 85 return BUG_ID; 86 } 87 88 /** 89 * {@inheritDoc} 90 */ 91 public String getBugName() { 92 return getClass().getName(); 93 } 94} 95