use of js.ExecutorTest in project TriggerReactor by wysohn.
the class TestExecutors method testRotateBlock.
@Override
public void testRotateBlock() throws Exception {
Location location = mock(Location.class);
Block block = mock(Block.class);
BlockState state = mock(BlockState.class);
Stairs data = mock(Stairs.class);
when(location.getBlock()).thenReturn(block);
when(block.getState()).thenReturn(state);
when(state.getData()).thenReturn(data);
new ExecutorTest(engine, "ROTATEBLOCK").withArgs(BlockFace.NORTH.name(), location).test();
verify(data).setFacingDirection(BlockFace.NORTH);
verify(state).setData(data);
}
use of js.ExecutorTest in project TriggerReactor by wysohn.
the class TestExecutors method testSignEdit.
@Override
public void testSignEdit() throws Exception {
Player player = mock(Player.class);
Location location = mock(Location.class);
Block block = mock(Block.class);
Sign sign = mock(Sign.class);
when(location.getBlock()).thenReturn(block);
when(block.getType()).thenReturn(Material.SIGN_POST);
when(block.getState()).thenReturn(sign);
new ExecutorTest(engine, "SIGNEDIT").withArgs(0, "line1", location).addVariable("player", player).test();
verify(sign).setLine(0, "line1");
verify(sign).update();
}
use of js.ExecutorTest in project TriggerReactor by wysohn.
the class TestExecutors method testSetBlock1_Legacy.
@Test
public void testSetBlock1_Legacy() throws Exception {
// {block id} {x} {y} {z}
World mockWorld = Mockito.mock(World.class);
Player player = Mockito.mock(Player.class);
Block block = mock(Block.class);
when(player.getWorld()).thenReturn(mockWorld);
when(mockWorld.getBlockAt(any(Location.class))).thenReturn(block);
when(server.getWorld("world")).thenReturn(mockWorld);
assertJSError(() -> new ExecutorTest(engine, "SETBLOCK").addVariable("player", player).withArgs(1, 33, 96, -15).test(), "Cannot use a number as block type after 1.12.2. Use material name directly.");
}
Aggregations