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");
}
Aggregations