use of js.JsTest in project TriggerReactor by wysohn.
the class TestExecutors method testMoney.
@Test
public void testMoney() throws Exception {
VaultSupport vVault = Mockito.mock(VaultSupport.class);
Player vp = Mockito.mock(Player.class);
JsTest test = new ExecutorTest(engine, "MONEY").addVariable("vault", vVault).addVariable("player", vp);
test.withArgs(30).test();
Mockito.verify(vVault).give(vp, 30);
test.withArgs(-30).test();
Mockito.verify(vVault).take(vp, 30);
assertJSError(() -> test.withArgs().test(), "Invalid parameter! [Number]");
assertJSError(() -> test.withArgs("nuu").test(), "Invalid parameter! [Number]");
}
Aggregations