use of il.ac.bgu.cs.bp.bpjs.model.eventsets.JsEventSet in project BPjs by bThink-BGU.
the class JsEventSetTest method testJsSetData.
@Test
public void testJsSetData() throws InterruptedException, URISyntaxException {
try {
Context.enter();
BProgram bpr = new StringBProgram("Eventset", "var es=bp.EventSet('a',function(e){return e.name=='a';});\n");
new BProgramRunner(bpr).run();
NativeJavaObject sut = (NativeJavaObject) bpr.getGlobalScope().get("es", bpr.getGlobalScope());
JsEventSet jsSut = (JsEventSet) Context.jsToJava(sut, JsEventSet.class);
assertEquals("a", jsSut.getName());
assertTrue(jsSut.toString().contains("a"));
assertTrue(jsSut.toString().contains("JsEventSet"));
assertTrue(jsSut.contains(BEvent.named("a")));
assertFalse(jsSut.contains(BEvent.named("b")));
} finally {
Context.exit();
}
}
Aggregations