Remove jOOR dependency, migrate tests

This commit is contained in:
JeremyStar™ 2024-07-15 13:13:55 +02:00
parent 97a0218bf6
commit 5697522641
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
8 changed files with 19 additions and 23 deletions

View file

@ -53,9 +53,6 @@ dependencies {
testImplementation(platform("org.junit:junit-bom:${dependencyJunit}")) testImplementation(platform("org.junit:junit-bom:${dependencyJunit}"))
testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// jOOR
testImplementation("org.jooq:joor:${dependencyJoor}")
} }
// Fix delombok task // Fix delombok task

View file

@ -20,15 +20,18 @@
package de.staropensource.sosengine.base.srctests; package de.staropensource.sosengine.base.srctests;
import de.staropensource.sosengine.base.EngineConfiguration; 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.base.types.logging.LogLevel;
import de.staropensource.sosengine.unittests.UnitLogger; import de.staropensource.sosengine.unittests.UnitLogger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.joor.Reflect;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -63,8 +66,8 @@ class EngineConfigurationTest {
* Sets the {@link EngineConfiguration}#{@code instance} to {@code null} after each test. * Sets the {@link EngineConfiguration}#{@code instance} to {@code null} after each test.
*/ */
@AfterEach @AfterEach
void clearClass() { void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException {
Reflect.onClass(EngineConfiguration.class).call("clearInstance"); Reflect.reflectOn(EngineConfiguration.class).getMethod("clearInstance").invoke();
} }
/** /**

View file

@ -22,10 +22,12 @@ package de.staropensource.sosengine.base.srctests.utility;
import de.staropensource.sosengine.base.EngineConfiguration; import de.staropensource.sosengine.base.EngineConfiguration;
import de.staropensource.sosengine.base.annotations.EventListener; import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.events.ThrowableCatchEvent; 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.base.utility.Miscellaneous;
import de.staropensource.sosengine.unittests.UnitLogger; import de.staropensource.sosengine.unittests.UnitLogger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.joor.Reflect;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; 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 org.junit.jupiter.params.provider.ValueSource;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -61,9 +64,9 @@ public class MiscellaneousTest {
* Sets the {@link EngineConfiguration}#{@code instance} to {@code null} after each test. * Sets the {@link EngineConfiguration}#{@code instance} to {@code null} after each test.
*/ */
@AfterEach @AfterEach
void clearConfiguration() { void clearConfiguration() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException {
// Only does something if 'EngineConfiguration#instance' is set, only applies to 'testExecuteSafely1' // For method testExecuteSafely1()
Reflect.onClass(EngineConfiguration.class).call("clearInstance"); Reflect.reflectOn(EngineConfiguration.class).getMethod("clearInstance").invoke();
} }
/** /**

View file

@ -20,16 +20,19 @@
package de.staropensource.sosengine.base.srctests.utility; package de.staropensource.sosengine.base.srctests.utility;
import de.staropensource.sosengine.base.classes.Placeholder; 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.base.utility.PlaceholderEngine;
import de.staropensource.sosengine.unittests.UnitLogger; import de.staropensource.sosengine.unittests.UnitLogger;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.joor.Reflect;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.CsvSource;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -58,8 +61,8 @@ class PlaceholderEngineTest {
* Sets the {@link PlaceholderEngine}#{@code instance} to {@code null} after each test. * Sets the {@link PlaceholderEngine}#{@code instance} to {@code null} after each test.
*/ */
@AfterEach @AfterEach
void clearInstance() { void clearInstance() throws InvalidMethodException, UnexpectedThrowableException, InvocationTargetException {
Reflect.onClass(PlaceholderEngine.class).call("clearInstance"); Reflect.reflectOn(PlaceholderEngine.class).getMethod("clearInstance").invoke();
} }
/** /**

View file

@ -36,7 +36,6 @@ dependencyLwjglNatives=
# Test dependencies # Test dependencies
dependencyJunit=5.11.0-M2 dependencyJunit=5.11.0-M2
dependencyJoor=0.9.14
# Plugins # Plugins
pluginShadow=8.1.7 pluginShadow=8.1.7

View file

@ -42,9 +42,6 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// jOOR
testImplementation("org.jooq:joor:${dependencyJoor}")
// -> Project <- // -> Project <-
implementation(project(":base")) implementation(project(":base"))
implementation("org.fusesource.jansi:jansi:${dependencyJansi}") // for some reason required or the build fails don"t ask me why implementation("org.fusesource.jansi:jansi:${dependencyJansi}") // for some reason required or the build fails don"t ask me why

View file

@ -91,9 +91,6 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// jOOR
testImplementation("org.jooq:joor:${dependencyJoor}")
// -> Project <- // -> Project <-
implementation(project(":base")) implementation(project(":base"))
implementation(project(":graphics")) implementation(project(":graphics"))

View file

@ -88,9 +88,6 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter") testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher") testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// jOOR
testImplementation("org.jooq:joor:${dependencyJoor}")
// -> Project <- // -> Project <-
implementation(project(":base")) implementation(project(":base"))
implementation(project(":graphics")) implementation(project(":graphics"))