No need to use reflection when Bck2Brwsr has public API lazyvm
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 11 Dec 2012 11:08:42 +0100
branchlazyvm
changeset 3043090a35d970f
parent 303 c12342170235
child 305 503b158cc093
No need to use reflection when Bck2Brwsr has public API
javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ProcessPageTest.java
     1.1 --- a/javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ProcessPageTest.java	Tue Dec 11 11:05:06 2012 +0100
     1.2 +++ b/javaquery/api/src/test/java/org/apidesign/bck2brwsr/htmlpage/ProcessPageTest.java	Tue Dec 11 11:08:42 2012 +0100
     1.3 @@ -19,12 +19,12 @@
     1.4  
     1.5  import java.io.IOException;
     1.6  import java.io.InputStream;
     1.7 -import java.lang.reflect.Method;
     1.8  import java.util.Set;
     1.9  import javax.script.Invocable;
    1.10  import javax.script.ScriptEngine;
    1.11  import javax.script.ScriptEngineManager;
    1.12  import javax.script.ScriptException;
    1.13 +import org.apidesign.vm4brwsr.Bck2Brwsr;
    1.14  import org.testng.annotations.Test;
    1.15  import static org.testng.Assert.*;
    1.16  
    1.17 @@ -125,15 +125,7 @@
    1.18          if (sb == null) {
    1.19              sb = new StringBuilder();
    1.20          }
    1.21 -        try {
    1.22 -            Method m;
    1.23 -            Class<?> genJS = Class.forName("org.apidesign.vm4brwsr.GenJS");
    1.24 -            m = genJS.getDeclaredMethod("compile", Appendable.class, String[].class);
    1.25 -            m.setAccessible(true);
    1.26 -            m.invoke(null, sb, names);
    1.27 -        } catch (Exception exception) {
    1.28 -            throw new IOException(exception);
    1.29 -        }
    1.30 +        Bck2Brwsr.generate(sb, ProcessPageTest.class.getClassLoader(), names);
    1.31          ScriptEngineManager sem = new ScriptEngineManager();
    1.32          ScriptEngine js = sem.getEngineByExtension("js");
    1.33          try {