test/com/sun/javadoc/testLambdaFeature/TestLambdaFeature.java

changeset 1468
690c41cdab55
child 1606
ccbe7ffdd867
equal deleted inserted replaced
1467:189b26e3818f 1468:690c41cdab55
1 /*
2 * Copyright (c) 2012, 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 8004893
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 */
34
35 public class TestLambdaFeature extends JavadocTester {
36
37 //Test information.
38 private static final String BUG_ID = "8004893";
39
40 //Javadoc arguments.
41 private static final String[] ARGS = new String[] {
42 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
43 };
44
45 //Input for string search tests.
46 private static final String[][] TEST = {
47 {BUG_ID + FS + "pkg" + FS + "A.html",
48 "<td class=\"colFirst\"><code>default void</code></td>"},
49 {BUG_ID + FS + "pkg" + FS + "A.html",
50 "<pre>default&nbsp;void&nbsp;defaultMethod()</pre>"},
51 {BUG_ID + FS + "pkg" + FS + "A.html",
52 "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
53 "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
54 "<span id=\"t2\" class=\"tableTab\"><span>" +
55 "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
56 "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
57 "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
58 "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>" +
59 "</span><span id=\"t5\" class=\"tableTab\"><span>" +
60 "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
61 "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
62 {BUG_ID + FS + "pkg" + FS + "A.html",
63 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
64 "<dd>This is a functional interface and can therefore be used as " +
65 "the assignment target for a lambda expression or method " +
66 "reference. </dd>" + NL + "</dl>"}
67 };
68 private static final String[][] NEGATED_TEST = {
69 {BUG_ID + FS + "pkg" + FS + "A.html",
70 "<td class=\"colFirst\"><code>default default void</code></td>"},
71 {BUG_ID + FS + "pkg" + FS + "A.html",
72 "<pre>default&nbsp;default&nbsp;void&nbsp;defaultMethod()</pre>"},
73 {BUG_ID + FS + "pkg" + FS + "B.html",
74 "<td class=\"colFirst\"><code>default void</code></td>"},
75 {BUG_ID + FS + "pkg" + FS + "B.html",
76 "<dl>" + NL + "<dt>Functional Interface:</dt>"}
77 };
78
79 /**
80 * The entry point of the test.
81 * @param args the array of command line arguments.
82 */
83 public static void main(String[] args) {
84 TestLambdaFeature tester = new TestLambdaFeature();
85 run(tester, ARGS, TEST, NEGATED_TEST);
86 tester.printSummary();
87 }
88
89 /**
90 * {@inheritDoc}
91 */
92 public String getBugId() {
93 return BUG_ID;
94 }
95
96 /**
97 * {@inheritDoc}
98 */
99 public String getBugName() {
100 return getClass().getName();
101 }
102 }

mercurial