Fix tests

This commit is contained in:
tastybento 2024-07-14 20:21:33 -07:00
parent 1c5a52de4c
commit b4ecb1dadd
3 changed files with 3 additions and 6 deletions

View File

@ -76,7 +76,6 @@ public class PhysicalInteractionListener extends FlagListener
boolean result = TAG_TO_FLAG.entrySet().stream().filter(entry -> entry.getKey().isTagged(block.getType())) boolean result = TAG_TO_FLAG.entrySet().stream().filter(entry -> entry.getKey().isTagged(block.getType()))
.findFirst().map(entry -> this.checkIsland(e, player, block.getLocation(), entry.getValue())) .findFirst().map(entry -> this.checkIsland(e, player, block.getLocation(), entry.getValue()))
.orElse(true); .orElse(true);
if (result && MAT_TO_FLAG.containsKey(block.getType())) { if (result && MAT_TO_FLAG.containsKey(block.getType())) {
result = this.checkIsland(e, player, block.getLocation(), MAT_TO_FLAG.get(block.getType())); result = this.checkIsland(e, player, block.getLocation(), MAT_TO_FLAG.get(block.getType()));
} }

View File

@ -282,13 +282,11 @@ public class PhysicalInteractionListenerTest extends AbstractCommonSetup {
// Test with wooden button // Test with wooden button
when(block1.getType()).thenReturn(Material.OAK_BUTTON); when(block1.getType()).thenReturn(Material.OAK_BUTTON);
when(Tag.WOODEN_BUTTONS.isTagged(Material.OAK_BUTTON)).thenReturn(true); when(Tag.WOODEN_BUTTONS.isTagged(Material.OAK_BUTTON)).thenReturn(true);
i.onProjectileExplode(e);
verify(notifier).notify(any(), eq("protection.protected"));
// Test with pressure plate // Test with pressure plate
when(block2.getType()).thenReturn(Material.STONE_PRESSURE_PLATE); when(block2.getType()).thenReturn(Material.STONE_PRESSURE_PLATE);
when(Tag.PRESSURE_PLATES.isTagged(Material.STONE_PRESSURE_PLATE)).thenReturn(true); when(Tag.PRESSURE_PLATES.isTagged(Material.STONE_PRESSURE_PLATE)).thenReturn(true);
i.onProjectileExplode(e); i.onProjectileExplode(e);
verify(notifier, times(3)).notify(any(), eq("protection.protected")); verify(notifier, times(2)).notify(any(), eq("protection.protected"));
} }
} }

View File

@ -46,7 +46,7 @@ public class FlagsManagerTest {
/** /**
* Update this value if the number of registered listeners changes * Update this value if the number of registered listeners changes
*/ */
private static final int NUMBER_OF_LISTENERS = 54; private static final int NUMBER_OF_LISTENERS = 55;
@Mock @Mock
private BentoBox plugin; private BentoBox plugin;
@Mock @Mock