From 569752264153465427188d02875243516285d77e Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Mon, 15 Jul 2024 13:13:55 +0200 Subject: [PATCH] Remove jOOR dependency, migrate tests --- base/build.gradle | 3 --- .../base/srctests/EngineConfigurationTest.java | 9 ++++++--- .../base/srctests/utility/MiscellaneousTest.java | 11 +++++++---- .../base/srctests/utility/PlaceholderEngineTest.java | 9 ++++++--- gradle.properties | 1 - graphics/build.gradle | 3 --- graphics/opengl/build.gradle | 3 --- graphics/vulkan/build.gradle | 3 --- 8 files changed, 19 insertions(+), 23 deletions(-) diff --git a/base/build.gradle b/base/build.gradle index 05fc54e..c38642d 100644 --- a/base/build.gradle +++ b/base/build.gradle @@ -53,9 +53,6 @@ dependencies { testImplementation(platform("org.junit:junit-bom:${dependencyJunit}")) testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - - // jOOR - testImplementation("org.jooq:joor:${dependencyJoor}") } // Fix delombok task diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/EngineConfigurationTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/EngineConfigurationTest.java index f137127..00ad689 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/EngineConfigurationTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/EngineConfigurationTest.java @@ -20,15 +20,18 @@ package de.staropensource.sosengine.base.srctests; import de.staropensource.sosengine.base.EngineConfiguration; +import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException; +import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodException; +import de.staropensource.sosengine.base.reflection.Reflect; import de.staropensource.sosengine.base.types.logging.LogLevel; import de.staropensource.sosengine.unittests.UnitLogger; import org.jetbrains.annotations.NotNull; -import org.joor.Reflect; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -63,8 +66,8 @@ class EngineConfigurationTest { * Sets the {@link EngineConfiguration}#{@code instance} to {@code null} after each test. */ @AfterEach - void clearClass() { - Reflect.onClass(EngineConfiguration.class).call("clearInstance"); + void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException { + Reflect.reflectOn(EngineConfiguration.class).getMethod("clearInstance").invoke(); } /** diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/MiscellaneousTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/MiscellaneousTest.java index 08a0351..a340cc5 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/MiscellaneousTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/MiscellaneousTest.java @@ -22,10 +22,12 @@ package de.staropensource.sosengine.base.srctests.utility; import de.staropensource.sosengine.base.EngineConfiguration; import de.staropensource.sosengine.base.annotations.EventListener; import de.staropensource.sosengine.base.events.ThrowableCatchEvent; +import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException; +import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodException; +import de.staropensource.sosengine.base.reflection.Reflect; import de.staropensource.sosengine.base.utility.Miscellaneous; import de.staropensource.sosengine.unittests.UnitLogger; import org.jetbrains.annotations.NotNull; -import org.joor.Reflect; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -34,6 +36,7 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; import java.lang.ref.WeakReference; +import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -61,9 +64,9 @@ public class MiscellaneousTest { * Sets the {@link EngineConfiguration}#{@code instance} to {@code null} after each test. */ @AfterEach - void clearConfiguration() { - // Only does something if 'EngineConfiguration#instance' is set, only applies to 'testExecuteSafely1' - Reflect.onClass(EngineConfiguration.class).call("clearInstance"); + void clearConfiguration() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException { + // For method testExecuteSafely1() + Reflect.reflectOn(EngineConfiguration.class).getMethod("clearInstance").invoke(); } /** diff --git a/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java b/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java index fd7029e..3091e98 100644 --- a/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java +++ b/base/src/test/java/de/staropensource/sosengine/base/srctests/utility/PlaceholderEngineTest.java @@ -20,16 +20,19 @@ package de.staropensource.sosengine.base.srctests.utility; import de.staropensource.sosengine.base.classes.Placeholder; +import de.staropensource.sosengine.base.exceptions.UnexpectedThrowableException; +import de.staropensource.sosengine.base.exceptions.reflection.InvalidMethodException; +import de.staropensource.sosengine.base.reflection.Reflect; import de.staropensource.sosengine.base.utility.PlaceholderEngine; import de.staropensource.sosengine.unittests.UnitLogger; import org.jetbrains.annotations.NotNull; -import org.joor.Reflect; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; @@ -58,8 +61,8 @@ class PlaceholderEngineTest { * Sets the {@link PlaceholderEngine}#{@code instance} to {@code null} after each test. */ @AfterEach - void clearInstance() { - Reflect.onClass(PlaceholderEngine.class).call("clearInstance"); + void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException { + Reflect.reflectOn(PlaceholderEngine.class).getMethod("clearInstance").invoke(); } /** diff --git a/gradle.properties b/gradle.properties index 129f225..135b5d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,7 +36,6 @@ dependencyLwjglNatives= # Test dependencies dependencyJunit=5.11.0-M2 -dependencyJoor=0.9.14 # Plugins pluginShadow=8.1.7 diff --git a/graphics/build.gradle b/graphics/build.gradle index 9dbee34..41e161b 100644 --- a/graphics/build.gradle +++ b/graphics/build.gradle @@ -42,9 +42,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - // jOOR - testImplementation("org.jooq:joor:${dependencyJoor}") - // -> Project <- implementation(project(":base")) implementation("org.fusesource.jansi:jansi:${dependencyJansi}") // for some reason required or the build fails don"t ask me why diff --git a/graphics/opengl/build.gradle b/graphics/opengl/build.gradle index 645466b..2bd21ec 100644 --- a/graphics/opengl/build.gradle +++ b/graphics/opengl/build.gradle @@ -91,9 +91,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - // jOOR - testImplementation("org.jooq:joor:${dependencyJoor}") - // -> Project <- implementation(project(":base")) implementation(project(":graphics")) diff --git a/graphics/vulkan/build.gradle b/graphics/vulkan/build.gradle index de0bd12..a875c46 100644 --- a/graphics/vulkan/build.gradle +++ b/graphics/vulkan/build.gradle @@ -88,9 +88,6 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") testRuntimeOnly("org.junit.platform:junit-platform-launcher") - // jOOR - testImplementation("org.jooq:joor:${dependencyJoor}") - // -> Project <- implementation(project(":base")) implementation(project(":graphics"))