launcher/fx/src/test/java/org/apidesign/bck2brwsr/launcher/fximpl/JsClassLoaderTest.java
changeset 1282 8d29792a09c6
parent 1227 5a907f38608d
child 1393 fc6250370fd5
     1.1 --- a/launcher/fx/src/test/java/org/apidesign/bck2brwsr/launcher/fximpl/JsClassLoaderTest.java	Wed Jun 26 18:44:21 2013 +0200
     1.2 +++ b/launcher/fx/src/test/java/org/apidesign/bck2brwsr/launcher/fximpl/JsClassLoaderTest.java	Thu Sep 12 14:15:47 2013 +0200
     1.3 @@ -35,6 +35,7 @@
     1.4  import org.apidesign.html.boot.impl.FnUtils;
     1.5  import static org.testng.Assert.*;
     1.6  import org.testng.annotations.BeforeClass;
     1.7 +import org.testng.annotations.BeforeMethod;
     1.8  import org.testng.annotations.Test;
     1.9  
    1.10  /**
    1.11 @@ -44,6 +45,7 @@
    1.12  public class JsClassLoaderTest {
    1.13      private static ClassLoader loader;
    1.14      private static Class<?> methodClass;
    1.15 +    private static Fn.Presenter presenter;
    1.16      
    1.17      public JsClassLoaderTest() {
    1.18      }
    1.19 @@ -82,7 +84,7 @@
    1.20                  sb.append("})()");
    1.21                  try {
    1.22                      final Object val = eng.eval(sb.toString());
    1.23 -                    return new Fn() {
    1.24 +                    return new Fn(this) {
    1.25                          @Override
    1.26                          public Object invoke(Object thiz, Object... args) throws Exception {
    1.27                              List<Object> all = new ArrayList<Object>(args.length + 1);
    1.28 @@ -109,10 +111,16 @@
    1.29              }
    1.30          }
    1.31          
    1.32 -        loader = FnUtils.newLoader(new Fr(), new Fr(), parent);
    1.33 +        Fr fr = new Fr();
    1.34 +        presenter = fr;
    1.35 +        loader = FnUtils.newLoader(fr, fr, parent);
    1.36          methodClass = loader.loadClass(JsMethods.class.getName());
    1.37      }
    1.38      
    1.39 +    @BeforeMethod public void registerPresenter() {
    1.40 +        FnUtils.currentPresenter(presenter);
    1.41 +    }
    1.42 +    
    1.43      @Test public void noParamMethod() throws Throwable {
    1.44          Method plus = methodClass.getMethod("fortyTwo");
    1.45          try {