// execute OK
updateUI(new RequestHandler() {
@Override
public void onRequest() {
PScript.get().execute("var i = 5; i + 2;", new ExecutionCallback() {
@Override
public void onSuccess(final String msg) {
eventsListener.stackCommandResult(new PTestEvent(this, "JS result: 7"));
}
@Override
public void onFailure(final String msg) {
log.error(msg);
}
});
}
});
final PTestEvent e1 = eventsListener.poll();
Assert.assertEquals("JS result: 7", e1.getBusinessMessage());
// execute KO
updateUI(new RequestHandler() {
@Override
public void onRequest() {
PScript.get().execute("j + 2;", new ExecutionCallback() {
@Override
public void onSuccess(final String msg) {
log.error(msg);
}