|
Groovy example source code file (InnerInterfaceTest.groovy)
The Groovy InnerInterfaceTest.groovy source codepackage gls.innerClass /** * Tests on inner interface usage * * @author Roshan Dawrani */ class InnerInterfaceTest extends GroovyTestCase { void testStaticInnerInterfaceInAClass() { assertScript """ public class Foo4422V1 { static public class Bar { def bar(){} } static public interface Baz { String TEST = "" def baz() } } class BazImpl implements Foo4422V1.Baz { def baz(){} } assert Foo4422V1.Bar != null assert Foo4422V1.Baz != null assert Foo4422V1.Bar.getMethod('bar') != null assert Foo4422V1.Baz.getMethod('baz') != null assert Foo4422V1.Baz.getField('TEST') != null assert BazImpl != null """ } void testStaticInnerInterfaceInAnInterface() { assertScript """ public interface Foo4422V2 { static public interface Baz {} } assert Foo4422V2.Baz != null """ } void testNonStaticInnerInterfaceInAClass() { assertScript """ public class Foo4422V3 { public class Bar {} public interface Baz {} } assert Foo4422V3.Bar != null assert Foo4422V3.Baz != null """ } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy InnerInterfaceTest.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.