Skip to content

Commit

Permalink
walshys suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAHuman-xD authored Apr 4, 2024
1 parent d8b1209 commit 351e1a7
Showing 1 changed file with 10 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,32 +80,18 @@ void testEventIsFired() {
server.getPluginManager().clearEvents();

// Assert the normal talisman does not activate in the ender chest
boolean caught = false;
try {
activateAnvilTalisman(false, true);
server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true);
} catch (AssertionError ignored) {
caught = true;
} finally {
if (!caught) {
throw new AssertionError("TalismanActivateEvent was fired when it should not have been");
}
}
server.getPluginManager().clearEvents();
activateAnvilTalisman(false, true);
Assertions.assertThrows(
AssertionError.class,
() -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true)
);

// Assert the ender talisman does not activate in the inventory
caught = false;
try {
activateAnvilTalisman(true, false);
server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true);
} catch (AssertionError ignored) {
caught = true;
} finally {
if (!caught) {
throw new AssertionError("TalismanActivateEvent was fired when it should not have been");
}
}
server.getPluginManager().clearEvents();
activateAnvilTalisman(true, false);
Assertions.assertThrows(
AssertionError.class,
() -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true)
);
}

@Test
Expand Down

0 comments on commit 351e1a7

Please sign in to comment.