Search in sources :

Example 1 with AnonymousInNonStaticMethod2

use of org.apache.flink.runtime.util.jartestprogram.AnonymousInNonStaticMethod2 in project flink by apache.

the class JarFileCreatorTest method TestAnonymousInnerClassTrick3.

//anonymous inner class in non static method accessing a field of its enclosing class.
@Test
public void TestAnonymousInnerClassTrick3() throws Exception {
    File out = new File(System.getProperty("java.io.tmpdir"), "jarcreatortest.jar");
    JarFileCreator jfc = new JarFileCreator(out);
    jfc.addClass(AnonymousInNonStaticMethod2.class).createJarFile();
    Set<String> ans = new HashSet<String>();
    ans.add("org/apache/flink/runtime/util/jartestprogram/AnonymousInNonStaticMethod2$1.class");
    ans.add("org/apache/flink/runtime/util/jartestprogram/AnonymousInNonStaticMethod2$A.class");
    ans.add("org/apache/flink/runtime/util/jartestprogram/AnonymousInNonStaticMethod2.class");
    Assert.assertTrue("Jar file for Anonymous Inner Class is not correct", validate(ans, out));
    out.delete();
}
Also used : AnonymousInNonStaticMethod2(org.apache.flink.runtime.util.jartestprogram.AnonymousInNonStaticMethod2) File(java.io.File) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

File (java.io.File)1 HashSet (java.util.HashSet)1 AnonymousInNonStaticMethod2 (org.apache.flink.runtime.util.jartestprogram.AnonymousInNonStaticMethod2)1 Test (org.junit.Test)1