From 45601c8aefc5f4d964119892043aab9378336c75 Mon Sep 17 00:00:00 2001 From: Alessio Colombo <37039432+Sfiguz7@users.noreply.github.com> Date: Sun, 7 Apr 2024 05:10:14 +0200 Subject: [PATCH] [ci skip] Actually check if the negative tests do their job (#4054) * Actually check if the negative tests do their job * Changed comments * walshys suggestion --------- Co-authored-by: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com> --- .../api/events/TestTalismanActivateEvent.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java index 94b1947cf..40cfc61fe 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java @@ -78,23 +78,20 @@ class TestTalismanActivateEvent { 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