rfield@1422: /* rfield@1422: * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. rfield@1422: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. rfield@1422: * rfield@1422: * This code is free software; you can redistribute it and/or modify it rfield@1422: * under the terms of the GNU General Public License version 2 only, as rfield@1422: * published by the Free Software Foundation. Oracle designates this rfield@1422: * particular file as subject to the "Classpath" exception as provided rfield@1422: * by Oracle in the LICENSE file that accompanied this code. rfield@1422: * rfield@1422: * This code is distributed in the hope that it will be useful, but WITHOUT rfield@1422: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or rfield@1422: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License rfield@1422: * version 2 for more details (a copy is included in the LICENSE file that rfield@1422: * accompanied this code). rfield@1422: * rfield@1422: * You should have received a copy of the GNU General Public License version rfield@1422: * 2 along with this work; if not, write to the Free Software Foundation, rfield@1422: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. rfield@1422: * rfield@1422: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA rfield@1422: * or visit www.oracle.com if you need additional information or have any rfield@1422: * questions. rfield@1422: */ rfield@1422: rfield@1422: /** rfield@1422: * @test rfield@1422: * @bug 8003639 rfield@1422: * @summary convert lambda testng tests to jtreg and add them rfield@1422: * @run testng InInterface rfield@1422: */ rfield@1422: rfield@1422: import static org.testng.Assert.assertEquals; rfield@1422: import org.testng.annotations.Test; rfield@1422: rfield@1422: interface LTII { rfield@1422: rfield@1422: interface ILsp1 { rfield@1422: String m(); rfield@1422: } rfield@1422: rfield@1422: interface ILsp2 { rfield@1422: String m(String x); rfield@1422: } rfield@1422: rfield@1422: default ILsp1 t1() { rfield@1422: return () -> { return "yo"; }; rfield@1422: } rfield@1422: rfield@1422: default ILsp2 t2() { rfield@1422: return (x) -> { return "snur" + x; }; rfield@1422: } rfield@1422: rfield@1422: } rfield@1422: rfield@1422: @Test rfield@1422: public class InInterface implements LTII { rfield@1422: rfield@1422: public void testLambdaInDefaultMethod() { rfield@1422: assertEquals(t1().m(), "yo"); rfield@1422: assertEquals(t2().m("p"), "snurp"); rfield@1422: } rfield@1422: rfield@1422: }