From 351e1a7b7a9d1d49b15667319a22237eaf83d8c1 Mon Sep 17 00:00:00 2001 From: JustAHuman-xD <65748158+JustAHuman-xD@users.noreply.github.com> Date: Thu, 4 Apr 2024 13:03:02 -0500 Subject: [PATCH] walshys suggestion --- .../api/events/TestTalismanActivateEvent.java | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 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 2ed902b0a1..55377ffc54 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 @@ -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