Skip to content

Commit c824533

Browse files
committed
Update BlockListenerTest2 to assert no exceptions are thrown during event handling
1 parent 0c55d53 commit c824533

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/test/java/world/bentobox/aoneblock/listeners/BlockListenerTest2.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package world.bentobox.aoneblock.listeners;
22

3+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
34
import static org.junit.jupiter.api.Assertions.assertFalse;
45
import static org.junit.jupiter.api.Assertions.assertTrue;
56
import static org.mockito.ArgumentMatchers.any;
@@ -81,7 +82,7 @@
8182
*
8283
* @author tastybento
8384
*/
84-
public class BlockListenerTest2 extends CommonTestSetup {
85+
class BlockListenerTest2 extends CommonTestSetup {
8586

8687
// Class under test
8788
private BlockListener bl;
@@ -291,7 +292,7 @@ void testOnPlayerInteractNullBlock() {
291292
PlayerInteractEvent e = makeInteractEvent(Action.RIGHT_CLICK_BLOCK, null, EquipmentSlot.HAND);
292293

293294
// Should not throw NPE
294-
bl.onPlayerInteract(e);
295+
assertDoesNotThrow(() -> bl.onPlayerInteract(e));
295296
}
296297

297298
/**
@@ -819,7 +820,7 @@ void testOnDeletedIslandInWorld() {
819820
mock(world.bentobox.bentobox.api.events.island.IslandDeleteEvent.class);
820821
when(e.getIsland()).thenReturn(toDelete);
821822

822-
bl.onDeletedIsland(e);
823+
assertDoesNotThrow(() -> bl.onDeletedIsland(e));
823824

824825
// Confirm the method completes without exception (cache and DB deletion happened)
825826
}
@@ -840,7 +841,7 @@ void testOnDeletedIslandNotInWorld() {
840841
mock(world.bentobox.bentobox.api.events.island.IslandDeleteEvent.class);
841842
when(e.getIsland()).thenReturn(toDelete);
842843

843-
bl.onDeletedIsland(e);
844+
assertDoesNotThrow(() -> bl.onDeletedIsland(e));
844845
// No exception; nothing to verify beyond the early return
845846
}
846847

0 commit comments

Comments
 (0)