Search in sources :

Example 1 with AbstractInventoryTriggerManager

use of io.github.wysohn.triggerreactor.core.manager.trigger.inventory.AbstractInventoryTriggerManager in project TriggerReactor by wysohn.

the class AbstractTestExecutors method testGUI.

@Test
public void testGUI() throws Exception {
    IPlayer vip = mock(IPlayer.class);
    TriggerReactorCore tr = mock(TriggerReactorCore.class);
    AbstractInventoryTriggerManager invManager = mock(AbstractInventoryTriggerManager.class);
    IInventory iInv = mock(IInventory.class);
    JsTest test = new ExecutorTest(engine, "GUI").addVariable("player", vip).addVariable("plugin", tr);
    when(tr.getInvManager()).thenReturn(invManager);
    when(invManager.openGUI(vip, "Hi")).thenReturn(iInv);
    test.withArgs("Hi").test();
    verify(invManager).openGUI(vip, "Hi");
    assertJSError(() -> test.withArgs().test(), "Invalid parameters. Need [String]");
    when(invManager.openGUI(vip, "hello")).thenReturn(null);
    assertJSError(() -> test.withArgs("hello").test(), "No such Inventory Trigger named hello");
}
Also used : IPlayer(io.github.wysohn.triggerreactor.core.bridge.entity.IPlayer) AbstractInventoryTriggerManager(io.github.wysohn.triggerreactor.core.manager.trigger.inventory.AbstractInventoryTriggerManager) IInventory(io.github.wysohn.triggerreactor.core.bridge.IInventory) BukkitTriggerReactorCore(io.github.wysohn.triggerreactor.bukkit.main.BukkitTriggerReactorCore) TriggerReactorCore(io.github.wysohn.triggerreactor.core.main.TriggerReactorCore) JsTest(js.JsTest) ExecutorTest(js.ExecutorTest) ExecutorTest(js.ExecutorTest) Test(org.junit.Test) JsTest(js.JsTest)

Aggregations

BukkitTriggerReactorCore (io.github.wysohn.triggerreactor.bukkit.main.BukkitTriggerReactorCore)1 IInventory (io.github.wysohn.triggerreactor.core.bridge.IInventory)1 IPlayer (io.github.wysohn.triggerreactor.core.bridge.entity.IPlayer)1 TriggerReactorCore (io.github.wysohn.triggerreactor.core.main.TriggerReactorCore)1 AbstractInventoryTriggerManager (io.github.wysohn.triggerreactor.core.manager.trigger.inventory.AbstractInventoryTriggerManager)1 ExecutorTest (js.ExecutorTest)1 JsTest (js.JsTest)1 Test (org.junit.Test)1