Search in sources :

Example 31 with JsTest

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]");
}
Also used : Player(org.bukkit.entity.Player) VaultSupport(io.github.wysohn.triggerreactor.bukkit.manager.trigger.share.api.vault.VaultSupport) JsTest(js.JsTest) ExecutorTest(js.ExecutorTest) Test(org.junit.Test) ExecutorTest(js.ExecutorTest) JsTest(js.JsTest)

Aggregations

JsTest (js.JsTest)31 Test (org.junit.Test)30 ExecutorTest (js.ExecutorTest)27 Player (org.bukkit.entity.Player)19 IPlayer (io.github.wysohn.triggerreactor.core.bridge.entity.IPlayer)18 Block (org.bukkit.block.Block)6 PlaceholderTest (js.PlaceholderTest)4 Entity (org.bukkit.entity.Entity)4 BlockState (org.bukkit.block.BlockState)3 Lever (org.bukkit.material.Lever)3 ArrayList (java.util.ArrayList)2 Callable (java.util.concurrent.Callable)2 ExecutorService (java.util.concurrent.ExecutorService)2 BukkitTriggerReactorCore (io.github.wysohn.triggerreactor.bukkit.main.BukkitTriggerReactorCore)1 VaultSupport (io.github.wysohn.triggerreactor.bukkit.manager.trigger.share.api.vault.VaultSupport)1 IInventory (io.github.wysohn.triggerreactor.core.bridge.IInventory)1 TriggerReactorCore (io.github.wysohn.triggerreactor.core.main.TriggerReactorCore)1 AbstractInventoryTriggerManager (io.github.wysohn.triggerreactor.core.manager.trigger.inventory.AbstractInventoryTriggerManager)1 World (org.bukkit.World)1 ItemFrame (org.bukkit.entity.ItemFrame)1