org.fest.assertions.Assertions.assertThat-sorg.dynjs.Config



Project dynjs/dynjs in file ...va.org.dynjs.runtime.AbstractDynJSTestSupport.java (2012-08-13)
@@ -1,19 +1,18 @@
 package org.dynjs.runtime;
 
-import org.junit.Before;
+import static org.fest.assertions.Assertions.*;
 
-import static org.fest.assertions.Assertions.assertThat;
+import org.dynjs.Config;
+import org.junit.Before;
 
 public abstract class AbstractDynJSTestSupport {
-    protected DynJS dynJS;
-    protected DynThreadContext context;
-    protected DynJSConfig config;
+    protected Config config;
+    protected JSEngine engine;
 
     @Before
     public void setUp() {
-        config = new DynJSConfig();
-        dynJS = new DynJS(getConfig());
-        context = new DynThreadContext();
+        this.config = new Config();
+        this.engine = new JSEngine( this.config );
     }
 
     protected void check(String scriptlet) {
@@ -21,31 +20,31 @@ public abstract class AbstractDynJSTestSupport {
     }
 
     protected void check(String scriptlet, Boolean expected) {
-        getDynJS().eval(getContext(), scriptlet);
-        Object result = getContext().getScope().resolve("result");
+        this.engine.execute( scriptlet, null, 0 );
+        Object result = this.engine.getExecutionContext().resolve( "result" );
         assertThat(result).isEqualTo(expected);
     }
 
     protected void check(String scriptlet, Object expected) {
-        getDynJS().eval(getContext(), scriptlet);
-        Object result = getContext().getScope().resolve("result");
+        this.engine.execute( scriptlet, null, 0 );
+        Object result = this.engine.getExecutionContext().resolve( "result" );
         assertThat(result).isEqualTo(expected);
     }
 
-    public DynJS getDynJS() {
-        return dynJS;
+    public JSEngine getEngine() {
+        return this.engine;
     }
 
-    public DynThreadContext getContext() {
-        return context;
+    public ExecutionContext getContext() {
+        return this.engine.getExecutionContext();
     }
 
-    public DynJSConfig getConfig() {
-        return config;
+    public Config getConfig() {
+        return this.engine.getConfig();
     }
 
     protected Object resultFor(String expression) {
-        getDynJS().eval(getContext(), expression);
-        return getContext().getScope().resolve("result");
+        this.engine.execute( expression, null, 0 );
+        return getContext().resolve("result");
     }
 }