Wed, 08 Oct 2014 14:16:40 -0700
Merge
1 /*
2 * Copyright (c) 2012, 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 8004893 8022738 8029143
27 * @summary Make sure that the lambda feature changes work fine in
28 * javadoc.
29 * @author bpatel
30 * @library ../lib/
31 * @build JavadocTester TestLambdaFeature
32 * @run main TestLambdaFeature
33 */
35 public class TestLambdaFeature extends JavadocTester {
37 //Test information.
38 private static final String BUG_ID = "8004893-8022738";
40 //Javadoc arguments.
41 private static final String[] ARGS = new String[] {
42 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "pkg1"
43 };
45 private static final String[] ARGS_1 = new String[] {
46 "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-source", "1.5", "pkg1"
47 };
49 //Input for string search tests.
50 private static final String[][] TEST = {
51 {BUG_ID + FS + "pkg" + FS + "A.html",
52 "<td class=\"colFirst\"><code>default void</code></td>"},
53 {BUG_ID + FS + "pkg" + FS + "A.html",
54 "<pre>default void defaultMethod()</pre>"},
55 {BUG_ID + FS + "pkg" + FS + "A.html",
56 "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
57 "All Methods</span><span class=\"tabEnd\"> </span></span>" +
58 "<span id=\"t2\" class=\"tableTab\"><span>" +
59 "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
60 "<span class=\"tabEnd\"> </span></span><span id=\"t3\" " +
61 "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
62 "Abstract Methods</a></span><span class=\"tabEnd\"> </span>" +
63 "</span><span id=\"t5\" class=\"tableTab\"><span>" +
64 "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
65 "<span class=\"tabEnd\"> </span></span></caption>"},
66 {BUG_ID + FS + "pkg" + FS + "A.html",
67 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
68 "<dd>This is a functional interface and can therefore be used as " +
69 "the assignment target for a lambda expression or method " +
70 "reference.</dd>" + NL + "</dl>"},
71 {BUG_ID + FS + "pkg1" + FS + "FuncInf.html",
72 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
73 "<dd>This is a functional interface and can therefore be used as " +
74 "the assignment target for a lambda expression or method " +
75 "reference.</dd>" + NL + "</dl>"}
76 };
77 private static final String[][] NEGATED_TEST = {
78 {BUG_ID + FS + "pkg" + FS + "A.html",
79 "<td class=\"colFirst\"><code>default default void</code></td>"},
80 {BUG_ID + FS + "pkg" + FS + "A.html",
81 "<pre>default default void defaultMethod()</pre>"},
82 {BUG_ID + FS + "pkg" + FS + "B.html",
83 "<td class=\"colFirst\"><code>default void</code></td>"},
84 {BUG_ID + FS + "pkg1" + FS + "NotAFuncInf.html",
85 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
86 "<dd>This is a functional interface and can therefore be used as " +
87 "the assignment target for a lambda expression or method " +
88 "reference.</dd>" + NL + "</dl>"},
89 {BUG_ID + FS + "pkg" + FS + "B.html",
90 "<dl>" + NL + "<dt>Functional Interface:</dt>"}
91 };
92 private static final String[][] NEGATED_TEST_1 = {
93 {BUG_ID + "-2" + FS + "pkg1" + FS + "FuncInf.html",
94 "<dl>" + NL + "<dt>Functional Interface:</dt>"}
95 };
97 /**
98 * The entry point of the test.
99 * @param args the array of command line arguments.
100 */
101 public static void main(String[] args) {
102 TestLambdaFeature tester = new TestLambdaFeature();
103 run(tester, ARGS, TEST, NEGATED_TEST);
104 run(tester, ARGS_1, NO_TEST, NEGATED_TEST_1);
105 tester.printSummary();
106 }
108 /**
109 * {@inheritDoc}
110 */
111 public String getBugId() {
112 return BUG_ID;
113 }
115 /**
116 * {@inheritDoc}
117 */
118 public String getBugName() {
119 return getClass().getName();
120 }
121 }