launcher/fx/src/test/java/org/apidesign/bck2brwsr/launcher/fximpl/JsClassLoaderTest.java
1.1 --- a/launcher/fx/src/test/java/org/apidesign/bck2brwsr/launcher/fximpl/JsClassLoaderTest.java Mon Jun 17 16:17:46 2013 +0200
1.2 +++ b/launcher/fx/src/test/java/org/apidesign/bck2brwsr/launcher/fximpl/JsClassLoaderTest.java Mon Jun 17 19:36:24 2013 +0200
1.3 @@ -76,7 +76,7 @@
1.4 final Object val = eng.eval(sb.toString());
1.5 return new Fn() {
1.6 @Override
1.7 - public Object invoke(Object... args) throws Exception {
1.8 + public Object invoke(Object thiz, Object... args) throws Exception {
1.9 Invocable inv = (Invocable)eng;
1.10 return inv.invokeMethod(val, "fn", args);
1.11 }
1.12 @@ -123,4 +123,34 @@
1.13 throw ex.getTargetException();
1.14 }
1.15 }
1.16 +
1.17 + @Test public void instanceMethod() throws Throwable {
1.18 + Method plus = methodClass.getMethod("plusInst", int.class);
1.19 + Object inst = methodClass.newInstance();
1.20 + try {
1.21 + assertEquals(plus.invoke(inst, 10), 10);
1.22 + } catch (InvocationTargetException ex) {
1.23 + throw ex.getTargetException();
1.24 + }
1.25 + }
1.26 +
1.27 + @Test public void staticThis() throws Throwable {
1.28 + Method st = methodClass.getMethod("staticThis");
1.29 + try {
1.30 + assertNull(st.invoke(null));
1.31 + } catch (InvocationTargetException ex) {
1.32 + throw ex.getTargetException();
1.33 + }
1.34 + }
1.35 +
1.36 + @Test public void getThis() throws Throwable {
1.37 + Object th = methodClass.newInstance();
1.38 + Method st = methodClass.getMethod("getThis");
1.39 + try {
1.40 + assertEquals(st.invoke(th), th);
1.41 + } catch (InvocationTargetException ex) {
1.42 + throw ex.getTargetException();
1.43 + }
1.44 + }
1.45 +
1.46 }
1.47 \ No newline at end of file