src/test/java/org/apidesign/java4browser/StaticMethodTest.java
changeset 18 361b76189f8d
parent 13 99f832e5765f
child 19 2291e553464a
     1.1 --- a/src/test/java/org/apidesign/java4browser/StaticMethodTest.java	Wed Sep 19 19:57:45 2012 +0200
     1.2 +++ b/src/test/java/org/apidesign/java4browser/StaticMethodTest.java	Thu Sep 20 14:20:01 2012 +0200
     1.3 @@ -19,6 +19,10 @@
     1.4  
     1.5  import java.io.IOException;
     1.6  import java.io.InputStream;
     1.7 +import java.util.Arrays;
     1.8 +import java.util.Iterator;
     1.9 +import java.util.Set;
    1.10 +import java.util.TreeSet;
    1.11  import javax.script.Invocable;
    1.12  import javax.script.ScriptEngine;
    1.13  import javax.script.ScriptEngineManager;
    1.14 @@ -131,7 +135,7 @@
    1.15      
    1.16      private static void assertExec(String msg, String methodName, Object expRes, Object... args) throws Exception {
    1.17          StringBuilder sb = new StringBuilder();
    1.18 -        Invocable i = compileClass(sb, "StaticMethod.class");
    1.19 +        Invocable i = compileClass(sb, "org/apidesign/java4browser/StaticMethod");
    1.20          
    1.21          Object ret = null;
    1.22          try {
    1.23 @@ -153,12 +157,12 @@
    1.24  
    1.25      static Invocable compileClass(StringBuilder sb, String... names) throws ScriptException, IOException {
    1.26          for (String name : names) {
    1.27 -            InputStream is = StaticMethodTest.class.getResourceAsStream(name);
    1.28 +            InputStream is = StaticMethodTest.class.getClassLoader().getResourceAsStream(name + ".class");
    1.29              assertNotNull(is, "Class file found");
    1.30              if (sb == null) {
    1.31                  sb = new StringBuilder();
    1.32              }
    1.33 -            ByteCodeToJavaScript.compile(name, is, sb);
    1.34 +            ByteCodeToJavaScript.compile(is, sb, null);
    1.35          }
    1.36          ScriptEngineManager sem = new ScriptEngineManager();
    1.37          ScriptEngine js = sem.getEngineByExtension("js");