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 */ 23 24 /* 25 * @test 26 * @bug 8004893 8022738 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 /* 36 * NOTE : This test should be elided when version 1.7 support is removed from the JDK 37 * or the negative part of the test showing 1.7's non-support should be 38 * removed [ 8022738 ] 39 */ 40 41 public class TestLambdaFeature extends JavadocTester { 42 43 //Test information. 44 private static final String BUG_ID = "8004893-8022738"; 45 46 //Javadoc arguments. 47 private static final String[] ARGS = new String[] { 48 "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg", "pkg1" 49 }; 50 51 private static final String[] ARGS_1 = new String[] { 52 "-d", BUG_ID + "-2", "-sourcepath", SRC_DIR, "-source", "1.7", "pkg1" 53 }; 54 55 //Input for string search tests. 56 private static final String[][] TEST = { 57 {BUG_ID + FS + "pkg" + FS + "A.html", 58 "<td class=\"colFirst\"><code>default void</code></td>"}, 59 {BUG_ID + FS + "pkg" + FS + "A.html", 60 "<pre>default void defaultMethod()</pre>"}, 61 {BUG_ID + FS + "pkg" + FS + "A.html", 62 "<caption><span id=\"t0\" class=\"activeTableTab\"><span>" + 63 "All Methods</span><span class=\"tabEnd\"> </span></span>" + 64 "<span id=\"t2\" class=\"tableTab\"><span>" + 65 "<a href=\"javascript:show(2);\">Instance Methods</a></span>" + 66 "<span class=\"tabEnd\"> </span></span><span id=\"t3\" " + 67 "class=\"tableTab\"><span><a href=\"javascript:show(4);\">" + 68 "Abstract Methods</a></span><span class=\"tabEnd\"> </span>" + 69 "</span><span id=\"t5\" class=\"tableTab\"><span>" + 70 "<a href=\"javascript:show(16);\">Default Methods</a></span>" + 71 "<span class=\"tabEnd\"> </span></span></caption>"}, 72 {BUG_ID + FS + "pkg" + FS + "A.html", 73 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL + 74 "<dd>This is a functional interface and can therefore be used as " + 75 "the assignment target for a lambda expression or method " + 76 "reference.</dd>" + NL + "</dl>"}, 77 {BUG_ID + FS + "pkg1" + FS + "FuncInf.html", 78 "<dl>" + NL + "<dt>Functional Interface:</dt>" + NL + 79 "<dd>This is a functional interface and can therefore be used as " + 80 "the assignment target for a lambda expression or method " + 81 "reference.</dd>" + NL + "</dl>"} 82 }; 83 private static final String[][] NEGATED_TEST = { 84 {BUG_ID + FS + "pkg" + FS + "A.html", 85 "<td class=\"colFirst\"><code>default default void</code></td>"}, 86 {BUG_ID + FS + "pkg" + FS + "A.html", 87 "<pre>default default void defaultMethod()</pre>"}, 88 {BUG_ID + FS + "pkg" + FS + "B.html", 89 "<td class=\"colFirst\"><code>default void</code></td>"}, 90 {BUG_ID + FS + "pkg" + FS + "B.html", 91 "<dl>" + NL + "<dt>Functional Interface:</dt>"} 92 }; 93 private static final String[][] NEGATED_TEST_1 = { 94 {BUG_ID + "-2" + FS + "pkg1" + FS + "FuncInf.html", 95 "<dl>" + NL + "<dt>Functional Interface:</dt>"} 96 }; 97 98 /** 99 * The entry point of the test. 100 * @param args the array of command line arguments. 101 */ 102 public static void main(String[] args) { 103 TestLambdaFeature tester = new TestLambdaFeature(); 104 run(tester, ARGS, TEST, NEGATED_TEST); 105 run(tester, ARGS_1, NO_TEST, NEGATED_TEST_1); 106 tester.printSummary(); 107 } 108 109 /** 110 * {@inheritDoc} 111 */ 112 public String getBugId() { 113 return BUG_ID; 114 } 115 116 /** 117 * {@inheritDoc} 118 */ 119 public String getBugName() { 120 return getClass().getName(); 121 } 122 }