turt2live

Untitled

Jan 24th, 2013
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.86 KB | None | 0 0
  1.  
  2.  
  3.     private Block stoneBlock, woodBlock, doorTop, doorBottom, bedHead, bedFoot, doorRel1, doorRel2, bedRel1, bedRel2;
  4. @Before
  5. public void setUp(){
  6.         // Setup beds/doors
  7.         doorTop = mock(Block.class);
  8.         doorBottom = mock(Block.class);
  9.         bedHead = mock(Block.class);
  10.         bedFoot = mock(Block.class);
  11.         doorRel1 = mock(Block.class);
  12.         bedRel1 = mock(Block.class);
  13.         doorRel2 = mock(Block.class);
  14.         bedRel2 = mock(Block.class);
  15.         when(doorTop.getType()).thenReturn(Material.IRON_DOOR_BLOCK);
  16.         when(doorBottom.getType()).thenReturn(Material.IRON_DOOR_BLOCK);
  17.         when(bedHead.getType()).thenReturn(Material.BED_BLOCK);
  18.         when(bedFoot.getType()).thenReturn(Material.BED_BLOCK);
  19.         when(doorRel1.getType()).thenReturn(Material.STONE);
  20.         when(doorRel2.getType()).thenReturn(Material.WOOD);
  21.         when(bedRel1.getType()).thenReturn(Material.FIRE);
  22.         when(bedRel2.getType()).thenReturn(Material.ANVIL);
  23.         BlockState bs1 = mock(BlockState.class), bs2 = mock(BlockState.class), bs3 = mock(BlockState.class), bs4 = mock(BlockState.class);
  24.         Door door1 = mock(Door.class), door2 = mock(Door.class);
  25.         Bed bed1 = mock(Bed.class), bed2 = mock(Bed.class);
  26.         when(door1.isTopHalf()).thenReturn(true);
  27.         when(door2.isTopHalf()).thenReturn(false);
  28.         when(bed1.isHeadOfBed()).thenReturn(true);
  29.         when(bed2.isHeadOfBed()).thenReturn(false);
  30.         when(bed1.getFacing()).thenReturn(BlockFace.EAST);
  31.         when(bed2.getFacing()).thenReturn(BlockFace.EAST);
  32.         when(bs1.getData()).thenReturn(door1);
  33.         when(bs2.getData()).thenReturn(door2);
  34.         when(bs3.getData()).thenReturn(bed1);
  35.         when(bs4.getData()).thenReturn(bed2);
  36.         when(doorTop.getState()).thenReturn(bs1);
  37.         when(doorBottom.getState()).thenReturn(bs2);
  38.         when(bedFoot.getState()).thenReturn(bs4);
  39.         when(bedHead.getState()).thenReturn(bs3);
  40.         when(doorTop.getRelative(BlockFace.DOWN)).thenReturn(doorRel1);
  41.         when(doorBottom.getRelative(BlockFace.UP)).thenReturn(doorRel2);
  42.         when(bedHead.getRelative(BlockFace.WEST)).thenReturn(bedRel1);
  43.         when(bedFoot.getRelative(BlockFace.EAST)).thenReturn(bedRel2);
  44. }
  45.  
  46.     @Test
  47.     public void testMultipleBlocks(){
  48.         /*
  49.          * D TOP = DOOR REL 1
  50.          * D BOT = DOOR REL 2
  51.          * B HED = BED REL 1
  52.          * B FOT = BED REL 2
  53.          *
  54.          * D REL 1 = STONE
  55.          * D REL 2 = WOOD
  56.          * B REL 1 = FIRE
  57.          * B REL 2 = ANVIL
  58.          */
  59.         assertNull(ASUtils.multipleBlocks(woodBlock));
  60.         assertNull(ASUtils.multipleBlocks(null));
  61.         assertNotNull(ASUtils.multipleBlocks(bedHead));
  62.         assertNotNull(ASUtils.multipleBlocks(bedFoot));
  63.         assertNotNull(ASUtils.multipleBlocks(doorTop));
  64.         assertNotNull(ASUtils.multipleBlocks(doorBottom));
  65.         assertEquals(Material.FIRE, ASUtils.multipleBlocks(bedHead).getType());
  66.         assertEquals(Material.ANVIL, ASUtils.multipleBlocks(bedFoot).getType());
  67.         assertEquals(Material.STONE, ASUtils.multipleBlocks(doorTop).getType());
  68.         assertEquals(Material.WOOD, ASUtils.multipleBlocks(doorBottom).getType());
  69.     }
Advertisement
Add Comment
Please, Sign In to add comment