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("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// jOOR
testImplementation("org.jooq:joor:${dependencyJoor}")
}
// Fix delombok task

View file

@ -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();
}
/**

View file

@ -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();
}
/**

View file

@ -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();
}
/**

View file

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

View file

@ -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

View file

@ -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"))

View file

@ -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"))