Skip to content

Commit

Permalink
[ci skip] Actually check if the negative tests do their job (#4054)
Browse files Browse the repository at this point in the history
* Actually check if the negative tests do their job

* Changed comments

* walshys suggestion

---------

Co-authored-by: JustAHuman-xD <[email protected]>
  • Loading branch information
Sfiguz7 and JustAHuman-xD authored Apr 7, 2024
1 parent 03e5b9a commit 45601c8
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,20 @@ void testEventIsFired() {
activateAnvilTalisman(true, true);
server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true);
server.getPluginManager().clearEvents();

// Assert the normal talisman does not activate in the ender chest
activateAnvilTalisman(false, true);
try {
server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true);
} catch (AssertionError ignored) {
return; // This is expected; the event should not have fired
}
server.getPluginManager().clearEvents();
Assertions.assertThrows(
AssertionError.class,
() -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true)
);

// Assert the ender talisman does not activate in the inventory
try {
activateAnvilTalisman(true, false);
server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true);
} catch (AssertionError ignored) {
return; // This is expected; the event should not have fired
}
server.getPluginManager().clearEvents();
activateAnvilTalisman(true, false);
Assertions.assertThrows(
AssertionError.class,
() -> server.getPluginManager().assertEventFired(TalismanActivateEvent.class, ignored -> true)
);
}

@Test
Expand Down

0 comments on commit 45601c8

Please sign in to comment.