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

Fri, 30 Aug 2013 16:38:54 -0700

author
bpatel
date
Fri, 30 Aug 2013 16:38:54 -0700
changeset 1998
b25e387481dc
parent 1606
ccbe7ffdd867
child 2233
4a6f853f8721
permissions
-rw-r--r--

8022738: doclet should only generate functional interface text if source >= 8
Reviewed-by: jjg

bpatel@1468 1 /*
bpatel@1998 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
bpatel@1468 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bpatel@1468 4 *
bpatel@1468 5 * This code is free software; you can redistribute it and/or modify it
bpatel@1468 6 * under the terms of the GNU General Public License version 2 only, as
bpatel@1468 7 * published by the Free Software Foundation.
bpatel@1468 8 *
bpatel@1468 9 * This code is distributed in the hope that it will be useful, but WITHOUT
bpatel@1468 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bpatel@1468 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bpatel@1468 12 * version 2 for more details (a copy is included in the LICENSE file that
bpatel@1468 13 * accompanied this code).
bpatel@1468 14 *
bpatel@1468 15 * You should have received a copy of the GNU General Public License version
bpatel@1468 16 * 2 along with this work; if not, write to the Free Software Foundation,
bpatel@1468 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bpatel@1468 18 *
bpatel@1468 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bpatel@1468 20 * or visit www.oracle.com if you need additional information or have any
bpatel@1468 21 * questions.
bpatel@1468 22 */
bpatel@1468 23
bpatel@1468 24 /*
bpatel@1468 25 * @test
bpatel@1998 26 * @bug 8004893 8022738
bpatel@1468 27 * @summary Make sure that the lambda feature changes work fine in
bpatel@1468 28 * javadoc.
bpatel@1468 29 * @author bpatel
bpatel@1468 30 * @library ../lib/
bpatel@1468 31 * @build JavadocTester TestLambdaFeature
bpatel@1468 32 * @run main TestLambdaFeature
bpatel@1468 33 */
bpatel@1468 34
bpatel@1468 35 public class TestLambdaFeature extends JavadocTester {
bpatel@1468 36
bpatel@1468 37 //Test information.
bpatel@1998 38 private static final String BUG_ID = "8004893-8022738";
bpatel@1468 39
bpatel@1468 40 //Javadoc arguments.
bpatel@1468 41 private static final String[] ARGS = new String[] {
bpatel@1998 42 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "pkg1"
bpatel@1998 43 };
bpatel@1998 44
bpatel@1998 45 private static final String[] ARGS_1 = new String[] {
bpatel@1998 46 "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-source", "1.5", "pkg1"
bpatel@1468 47 };
bpatel@1468 48
bpatel@1468 49 //Input for string search tests.
bpatel@1468 50 private static final String[][] TEST = {
bpatel@1468 51 {BUG_ID + FS + "pkg" + FS + "A.html",
bpatel@1468 52 "<td class=\"colFirst\"><code>default void</code></td>"},
bpatel@1468 53 {BUG_ID + FS + "pkg" + FS + "A.html",
bpatel@1468 54 "<pre>default&nbsp;void&nbsp;defaultMethod()</pre>"},
bpatel@1468 55 {BUG_ID + FS + "pkg" + FS + "A.html",
bpatel@1468 56 "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" +
bpatel@1468 57 "All Methods</span><span class=\"tabEnd\">&nbsp;</span></span>" +
bpatel@1468 58 "<span id=\"t2\" class=\"tableTab\"><span>" +
bpatel@1468 59 "<a href=\"javascript:show(2);\">Instance Methods</a></span>" +
bpatel@1468 60 "<span class=\"tabEnd\">&nbsp;</span></span><span id=\"t3\" " +
bpatel@1468 61 "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" +
bpatel@1468 62 "Abstract Methods</a></span><span class=\"tabEnd\">&nbsp;</span>" +
bpatel@1468 63 "</span><span id=\"t5\" class=\"tableTab\"><span>" +
bpatel@1468 64 "<a href=\"javascript:show(16);\">Default Methods</a></span>" +
bpatel@1468 65 "<span class=\"tabEnd\">&nbsp;</span></span></caption>"},
bpatel@1468 66 {BUG_ID + FS + "pkg" + FS + "A.html",
bpatel@1468 67 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
bpatel@1468 68 "<dd>This is a functional interface and can therefore be used as " +
bpatel@1468 69 "the assignment target for a lambda expression or method " +
bpatel@1998 70 "reference.</dd>" + NL + "</dl>"},
bpatel@1998 71 {BUG_ID + FS + "pkg1" + FS + "FuncInf.html",
bpatel@1998 72 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL +
bpatel@1998 73 "<dd>This is a functional interface and can therefore be used as " +
bpatel@1998 74 "the assignment target for a lambda expression or method " +
jjg@1606 75 "reference.</dd>" + NL + "</dl>"}
bpatel@1468 76 };
bpatel@1468 77 private static final String[][] NEGATED_TEST = {
bpatel@1468 78 {BUG_ID + FS + "pkg" + FS + "A.html",
bpatel@1468 79 "<td class=\"colFirst\"><code>default default void</code></td>"},
bpatel@1468 80 {BUG_ID + FS + "pkg" + FS + "A.html",
bpatel@1468 81 "<pre>default&nbsp;default&nbsp;void&nbsp;defaultMethod()</pre>"},
bpatel@1468 82 {BUG_ID + FS + "pkg" + FS + "B.html",
bpatel@1468 83 "<td class=\"colFirst\"><code>default void</code></td>"},
bpatel@1468 84 {BUG_ID + FS + "pkg" + FS + "B.html",
bpatel@1468 85 "<dl>" + NL + "<dt>Functional Interface:</dt>"}
bpatel@1468 86 };
bpatel@1998 87 private static final String[][] NEGATED_TEST_1 = {
bpatel@1998 88 {BUG_ID + "-2" + FS + "pkg1" + FS + "FuncInf.html",
bpatel@1998 89 "<dl>" + NL + "<dt>Functional Interface:</dt>"}
bpatel@1998 90 };
bpatel@1468 91
bpatel@1468 92 /**
bpatel@1468 93 * The entry point of the test.
bpatel@1468 94 * @param args the array of command line arguments.
bpatel@1468 95 */
bpatel@1468 96 public static void main(String[] args) {
bpatel@1468 97 TestLambdaFeature tester = new TestLambdaFeature();
bpatel@1468 98 run(tester, ARGS, TEST, NEGATED_TEST);
bpatel@1998 99 run(tester, ARGS_1, NO_TEST, NEGATED_TEST_1);
bpatel@1468 100 tester.printSummary();
bpatel@1468 101 }
bpatel@1468 102
bpatel@1468 103 /**
bpatel@1468 104 * {@inheritDoc}
bpatel@1468 105 */
bpatel@1468 106 public String getBugId() {
bpatel@1468 107 return BUG_ID;
bpatel@1468 108 }
bpatel@1468 109
bpatel@1468 110 /**
bpatel@1468 111 * {@inheritDoc}
bpatel@1468 112 */
bpatel@1468 113 public String getBugName() {
bpatel@1468 114 return getClass().getName();
bpatel@1468 115 }
bpatel@1468 116 }

mercurial