diff --git a/base/src/test/java/de/staropensource/engine/base/srctests/utility/MiscellaneousTest.java b/base/src/test/java/de/staropensource/engine/base/srctests/utility/MiscellaneousTest.java index 3ffb39a..04b7dd9 100644 --- a/base/src/test/java/de/staropensource/engine/base/srctests/utility/MiscellaneousTest.java +++ b/base/src/test/java/de/staropensource/engine/base/srctests/utility/MiscellaneousTest.java @@ -19,12 +19,9 @@ package de.staropensource.engine.base.srctests.utility; -import de.staropensource.engine.base.EngineConfiguration; -import de.staropensource.engine.base.annotation.EventListener; import de.staropensource.engine.testing.TestBase; import de.staropensource.engine.base.utility.misc.NumberUtil; import de.staropensource.engine.base.utility.misc.Miscellaneous; -import org.jetbrains.annotations.NotNull; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -33,7 +30,6 @@ import org.junit.jupiter.params.provider.ValueSource; import java.util.HashMap; import java.util.Map; -import java.util.Properties; import java.util.Set; import static org.junit.jupiter.api.Assertions.*; @@ -113,51 +109,4 @@ public class MiscellaneousTest extends TestBase { assertTrue(output.contains("keydrei"), "Map key \"keydrei\" not found in output Set"); assertEquals(2, output.size(), "There are more or less than two keys in the output Set"); } - - /** - * Tests the method {@code executeSafely}. - */ - @Test - @DisplayName("executeSafely (test 1)") - void testExecuteSafely1() { - if (performMethodCalls("testExecuteSafely1")) - return; - - throwableCaught = false; - - // Disable event optimization for instant results - Properties properties = new Properties(); - properties.setProperty("sosengine.base.debug", "true"); - properties.setProperty("sosengine.base.debugEvents", "true"); - properties.setProperty("sosengine.base.loggerLevel", "diagnostic"); - properties.setProperty("sosengine.base.optimizeLogging", "false"); - properties.setProperty("sosengine.base.optimizeEvents", "false"); - EngineConfiguration.getInstance().loadConfiguration(properties); - - Miscellaneous.executeSafely(() -> { - throw new ArrayIndexOutOfBoundsException("This is not an accident!"); - }, "MiscellaneousTest#testExecuteSafely1"); - - try { - Thread.sleep(200); - } catch (InterruptedException e) { - getLogger().error("Sleep was interrupted, test may fail"); - throw new RuntimeException(e); - } - - assertTrue(throwableCaught, "Event wasn't triggered"); - } - - /** - * Updates {@code throwableCaught}. - * - * @param throwable throwable - * @param identifier identifier - */ - @EventListener(event = ThrowableCatchEvent.class) - @SuppressWarnings({ "unused" }) - public static void onCaughtThrowable(@NotNull Throwable throwable, @NotNull String identifier) { - getInstance().getLogger().diag("ThrowableCatchEvent received"); - throwableCaught = true; - } }