Skip to content

Commit

Permalink
Fixes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed May 31, 2020
1 parent 3460fbb commit 7e82dbd
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ public void setUp() throws Exception {
when(location.getWorld()).thenReturn(world);
when(location2.getWorld()).thenReturn(world);
when(block.getType()).thenReturn(Material.LAVA);
when(block.isLiquid()).thenReturn(true);
when(block2.getType()).thenReturn(Material.WATER);
when(block2.isLiquid()).thenReturn(true);
when(block2.getRelative(any())).thenReturn(block3);
when(block3.getType()).thenReturn(Material.LAVA);
when(block3.isLiquid()).thenReturn(true);

// Generator
when(addon.getGenerator()).thenReturn(mg);
Expand Down Expand Up @@ -160,6 +163,7 @@ public void testOnBlockFromToEventSuccess() {
@Test
public void testOnBlockFromToEventSuccessAir() {
when(block2.getType()).thenReturn(Material.AIR);
when(block2.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertFalse(event.isCancelled());
Expand All @@ -172,6 +176,7 @@ public void testOnBlockFromToEventSuccessAir() {
@Test
public void testOnBlockFromToEventSuccessVoidAir() {
when(block2.getType()).thenReturn(Material.VOID_AIR);
when(block2.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertFalse(event.isCancelled());
Expand All @@ -184,6 +189,7 @@ public void testOnBlockFromToEventSuccessVoidAir() {
@Test
public void testOnBlockFromToEventSuccessCaveAir() {
when(block2.getType()).thenReturn(Material.CAVE_AIR);
when(block2.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertFalse(event.isCancelled());
Expand All @@ -197,6 +203,7 @@ public void testOnBlockFromToEventSuccessCaveAir() {
public void testOnBlockFromToEventSuccessWaterAirLava() {
when(block.getType()).thenReturn(Material.WATER);
when(block2.getType()).thenReturn(Material.AIR);
when(block2.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertTrue(event.isCancelled());
Expand All @@ -210,6 +217,7 @@ public void testOnBlockFromToEventSuccessWaterAirLava() {
public void testOnBlockFromToEventSuccessWaterVoidAirLava() {
when(block.getType()).thenReturn(Material.WATER);
when(block2.getType()).thenReturn(Material.VOID_AIR);
when(block2.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertTrue(event.isCancelled());
Expand All @@ -223,6 +231,7 @@ public void testOnBlockFromToEventSuccessWaterVoidAirLava() {
public void testOnBlockFromToEventSuccessWaterCaveAirLava() {
when(block.getType()).thenReturn(Material.WATER);
when(block2.getType()).thenReturn(Material.CAVE_AIR);
when(block2.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertTrue(event.isCancelled());
Expand Down Expand Up @@ -270,6 +279,7 @@ public void testOnBlockFromToEventSameBlock() {
@Test
public void testOnBlockFromToEventWrongType() {
when(block.getType()).thenReturn(Material.AIR);
when(block.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertFalse(event.isCancelled());
Expand All @@ -294,7 +304,9 @@ public void testOnBlockFromToEventSameType() {
@Test
public void testOnBlockFromToEventLava2AirAboveAir() {
when(block2.getType()).thenReturn(Material.AIR);
when(block2.isLiquid()).thenReturn(false);
when(block3.getType()).thenReturn(Material.AIR);
when(block3.isLiquid()).thenReturn(false);
BlockFromToEvent event = new BlockFromToEvent(block, block2);
mgl.onBlockFromToEvent(event);
assertFalse(event.isCancelled());
Expand Down

0 comments on commit 7e82dbd

Please sign in to comment.