Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Block stoneBlock, woodBlock, doorTop, doorBottom, bedHead, bedFoot, doorRel1, doorRel2, bedRel1, bedRel2;
- @Before
- public void setUp(){
- // Setup beds/doors
- doorTop = mock(Block.class);
- doorBottom = mock(Block.class);
- bedHead = mock(Block.class);
- bedFoot = mock(Block.class);
- doorRel1 = mock(Block.class);
- bedRel1 = mock(Block.class);
- doorRel2 = mock(Block.class);
- bedRel2 = mock(Block.class);
- when(doorTop.getType()).thenReturn(Material.IRON_DOOR_BLOCK);
- when(doorBottom.getType()).thenReturn(Material.IRON_DOOR_BLOCK);
- when(bedHead.getType()).thenReturn(Material.BED_BLOCK);
- when(bedFoot.getType()).thenReturn(Material.BED_BLOCK);
- when(doorRel1.getType()).thenReturn(Material.STONE);
- when(doorRel2.getType()).thenReturn(Material.WOOD);
- when(bedRel1.getType()).thenReturn(Material.FIRE);
- when(bedRel2.getType()).thenReturn(Material.ANVIL);
- BlockState bs1 = mock(BlockState.class), bs2 = mock(BlockState.class), bs3 = mock(BlockState.class), bs4 = mock(BlockState.class);
- Door door1 = mock(Door.class), door2 = mock(Door.class);
- Bed bed1 = mock(Bed.class), bed2 = mock(Bed.class);
- when(door1.isTopHalf()).thenReturn(true);
- when(door2.isTopHalf()).thenReturn(false);
- when(bed1.isHeadOfBed()).thenReturn(true);
- when(bed2.isHeadOfBed()).thenReturn(false);
- when(bed1.getFacing()).thenReturn(BlockFace.EAST);
- when(bed2.getFacing()).thenReturn(BlockFace.EAST);
- when(bs1.getData()).thenReturn(door1);
- when(bs2.getData()).thenReturn(door2);
- when(bs3.getData()).thenReturn(bed1);
- when(bs4.getData()).thenReturn(bed2);
- when(doorTop.getState()).thenReturn(bs1);
- when(doorBottom.getState()).thenReturn(bs2);
- when(bedFoot.getState()).thenReturn(bs4);
- when(bedHead.getState()).thenReturn(bs3);
- when(doorTop.getRelative(BlockFace.DOWN)).thenReturn(doorRel1);
- when(doorBottom.getRelative(BlockFace.UP)).thenReturn(doorRel2);
- when(bedHead.getRelative(BlockFace.WEST)).thenReturn(bedRel1);
- when(bedFoot.getRelative(BlockFace.EAST)).thenReturn(bedRel2);
- }
- @Test
- public void testMultipleBlocks(){
- /*
- * D TOP = DOOR REL 1
- * D BOT = DOOR REL 2
- * B HED = BED REL 1
- * B FOT = BED REL 2
- *
- * D REL 1 = STONE
- * D REL 2 = WOOD
- * B REL 1 = FIRE
- * B REL 2 = ANVIL
- */
- assertNull(ASUtils.multipleBlocks(woodBlock));
- assertNull(ASUtils.multipleBlocks(null));
- assertNotNull(ASUtils.multipleBlocks(bedHead));
- assertNotNull(ASUtils.multipleBlocks(bedFoot));
- assertNotNull(ASUtils.multipleBlocks(doorTop));
- assertNotNull(ASUtils.multipleBlocks(doorBottom));
- assertEquals(Material.FIRE, ASUtils.multipleBlocks(bedHead).getType());
- assertEquals(Material.ANVIL, ASUtils.multipleBlocks(bedFoot).getType());
- assertEquals(Material.STONE, ASUtils.multipleBlocks(doorTop).getType());
- assertEquals(Material.WOOD, ASUtils.multipleBlocks(doorBottom).getType());
- }
Advertisement
Add Comment
Please, Sign In to add comment