Move testing infrastructure into separate subproject
This commit is contained in:
parent
4bbc1fd683
commit
104e378856
24 changed files with 310 additions and 107 deletions
|
@ -47,6 +47,9 @@ 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")
|
||||||
|
|
||||||
|
// -> Project <-
|
||||||
|
testImplementation(project(":testing"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix delombok task
|
// Fix delombok task
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.io.PrintStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains {@link java.io.PrintStream}s for the standard
|
* Contains {@link PrintStream}s for the standard
|
||||||
* output and standard error streams, which redirect
|
* output and standard error streams, which redirect
|
||||||
* their input into the engine's logging infrastructure.
|
* their input into the engine's logging infrastructure.
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,7 +33,6 @@ module sosengine.base {
|
||||||
exports de.staropensource.sosengine.base.type.vector;
|
exports de.staropensource.sosengine.base.type.vector;
|
||||||
exports de.staropensource.sosengine.base.utility;
|
exports de.staropensource.sosengine.base.utility;
|
||||||
exports de.staropensource.sosengine.base.implementation.shortcode;
|
exports de.staropensource.sosengine.base.implementation.shortcode;
|
||||||
exports de.staropensource.sosengine.unittest;
|
|
||||||
|
|
||||||
// Reflection access
|
// Reflection access
|
||||||
opens de.staropensource.sosengine.base;
|
opens de.staropensource.sosengine.base;
|
||||||
|
@ -58,5 +57,4 @@ module sosengine.base {
|
||||||
opens de.staropensource.sosengine.base.type.vector;
|
opens de.staropensource.sosengine.base.type.vector;
|
||||||
opens de.staropensource.sosengine.base.utility;
|
opens de.staropensource.sosengine.base.utility;
|
||||||
opens de.staropensource.sosengine.base.implementation.shortcode;
|
opens de.staropensource.sosengine.base.implementation.shortcode;
|
||||||
opens de.staropensource.sosengine.unittest;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package de.staropensource.sosengine.base.srctests;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||||
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
||||||
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package de.staropensource.sosengine.base.srctests.implementation.versioning;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.FourNumberVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.FourNumberVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
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;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package de.staropensource.sosengine.base.srctests.implementation.versioning;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
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;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package de.staropensource.sosengine.base.srctests.implementation.versioning;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.SemanticVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.SemanticVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
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;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package de.staropensource.sosengine.base.srctests.implementation.versioning;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.StarOpenSourceVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.StarOpenSourceVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
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;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package de.staropensource.sosengine.base.srctests.implementation.versioning;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.ThreeNumberVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.ThreeNumberVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
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;
|
||||||
|
|
|
@ -21,7 +21,7 @@ package de.staropensource.sosengine.base.srctests.implementation.versioning;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.TwoNumberVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.TwoNumberVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
import de.staropensource.sosengine.base.exception.versioning.InvalidVersionStringException;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
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;
|
||||||
|
|
|
@ -22,7 +22,7 @@ package de.staropensource.sosengine.base.srctests.utility;
|
||||||
import de.staropensource.sosengine.base.exception.dependency.DependencyCycleException;
|
import de.staropensource.sosengine.base.exception.dependency.DependencyCycleException;
|
||||||
import de.staropensource.sosengine.base.exception.dependency.UnmetDependenciesException;
|
import de.staropensource.sosengine.base.exception.dependency.UnmetDependenciesException;
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
import de.staropensource.sosengine.base.type.DependencyVector;
|
import de.staropensource.sosengine.base.type.DependencyVector;
|
||||||
import de.staropensource.sosengine.base.utility.DependencyResolver;
|
import de.staropensource.sosengine.base.utility.DependencyResolver;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -289,9 +289,9 @@ class DependencyResolverTest extends TestBase {
|
||||||
1, 2, 3
|
1, 2, 3
|
||||||
})
|
})
|
||||||
void testResolveWithFailure(int layers) {
|
void testResolveWithFailure(int layers) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testResolveWithFailure", layers))
|
||||||
|
return;
|
||||||
|
|
||||||
getLogger().testCall("testResolveWithFailure", layers);
|
|
||||||
DependencyResolver resolver = new DependencyResolver();
|
DependencyResolver resolver = new DependencyResolver();
|
||||||
Set<@NotNull DependencyVector> vectors = new HashSet<>();
|
Set<@NotNull DependencyVector> vectors = new HashSet<>();
|
||||||
Set<@NotNull String> dependencies = new HashSet<>();
|
Set<@NotNull String> dependencies = new HashSet<>();
|
||||||
|
@ -512,9 +512,9 @@ class DependencyResolverTest extends TestBase {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("resolve (dependency cycle)")
|
@DisplayName("resolve (dependency cycle)")
|
||||||
void testResolveDependencyCycle() {
|
void testResolveDependencyCycle() {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testResolveDependencyCycle"))
|
||||||
|
return;
|
||||||
|
|
||||||
getLogger().testCall("testResolveDependencyCycle");
|
|
||||||
DependencyResolver resolver = new DependencyResolver();
|
DependencyResolver resolver = new DependencyResolver();
|
||||||
Set<@NotNull DependencyVector> vectors = new HashSet<>();
|
Set<@NotNull DependencyVector> vectors = new HashSet<>();
|
||||||
Set<@NotNull String> dependencies = new HashSet<>();
|
Set<@NotNull String> dependencies = new HashSet<>();
|
||||||
|
|
|
@ -22,7 +22,7 @@ package de.staropensource.sosengine.base.srctests.utility;
|
||||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||||
import de.staropensource.sosengine.base.annotation.EventListener;
|
import de.staropensource.sosengine.base.annotation.EventListener;
|
||||||
import de.staropensource.sosengine.base.event.ThrowableCatchEvent;
|
import de.staropensource.sosengine.base.event.ThrowableCatchEvent;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
import de.staropensource.sosengine.base.utility.Math;
|
import de.staropensource.sosengine.base.utility.Math;
|
||||||
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
import de.staropensource.sosengine.base.utility.Miscellaneous;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -78,8 +78,8 @@ public class MiscellaneousTest extends TestBase {
|
||||||
100, 250, 500
|
100, 250, 500
|
||||||
})
|
})
|
||||||
void testMeasureExecutionTime(int sleepingDuration) {
|
void testMeasureExecutionTime(int sleepingDuration) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testMeasureExecutionTime"))
|
||||||
getLogger().testCall("testMeasureExecutionTime", sleepingDuration);
|
return;
|
||||||
|
|
||||||
long executionTime = Miscellaneous.measureExecutionTime(() -> {
|
long executionTime = Miscellaneous.measureExecutionTime(() -> {
|
||||||
try {
|
try {
|
||||||
|
@ -98,8 +98,8 @@ public class MiscellaneousTest extends TestBase {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("getMapValues")
|
@DisplayName("getMapValues")
|
||||||
void testGetMapValues() {
|
void testGetMapValues() {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetMapValues"))
|
||||||
getLogger().testCall("testGetMapValues");
|
return;
|
||||||
|
|
||||||
Map<String, String> testMap = new HashMap<>();
|
Map<String, String> testMap = new HashMap<>();
|
||||||
testMap.put("key1", "this is the first value");
|
testMap.put("key1", "this is the first value");
|
||||||
|
@ -121,8 +121,8 @@ public class MiscellaneousTest extends TestBase {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("executeSafely (test 0)")
|
@DisplayName("executeSafely (test 0)")
|
||||||
void testExecuteSafely0() {
|
void testExecuteSafely0() {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testExecuteSafely0"))
|
||||||
getLogger().testCall("testExecuteSafely0");
|
return;
|
||||||
|
|
||||||
throwableCaught = false;
|
throwableCaught = false;
|
||||||
Miscellaneous.executeSafely(() -> System.out.println("You can safely ignore this message (this comes from MiscellaneousTest#testExecuteSafely0)"), "MiscellaneousTest#testExecuteSafely0");
|
Miscellaneous.executeSafely(() -> System.out.println("You can safely ignore this message (this comes from MiscellaneousTest#testExecuteSafely0)"), "MiscellaneousTest#testExecuteSafely0");
|
||||||
|
@ -136,8 +136,9 @@ public class MiscellaneousTest extends TestBase {
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("executeSafely (test 1)")
|
@DisplayName("executeSafely (test 1)")
|
||||||
void testExecuteSafely1() {
|
void testExecuteSafely1() {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testExecuteSafely1"))
|
||||||
getLogger().testCall("testExecuteSafely1");
|
return;
|
||||||
|
|
||||||
throwableCaught = false;
|
throwableCaught = false;
|
||||||
|
|
||||||
// Disable event optimization for instant results
|
// Disable event optimization for instant results
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
package de.staropensource.sosengine.base.srctests.utility;
|
package de.staropensource.sosengine.base.srctests.utility;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.implementable.Placeholder;
|
import de.staropensource.sosengine.base.implementable.Placeholder;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
|
import de.staropensource.sosengine.base.utility.PlaceholderEngine;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.srctests.utility;
|
package de.staropensource.sosengine.base.srctests.utility;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.testing.TestBase;
|
||||||
import de.staropensource.sosengine.base.utility.PropertiesReader;
|
import de.staropensource.sosengine.base.utility.PropertiesReader;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.params.ParameterizedTest;
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
@ -71,8 +71,8 @@ class PropertiesReaderTest extends TestBase {
|
||||||
"nah, no, false",
|
"nah, no, false",
|
||||||
})
|
})
|
||||||
void testGetBoolean(String propertyName, String propertyValue, boolean expected) {
|
void testGetBoolean(String propertyName, String propertyValue, boolean expected) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetBoolean", propertyName, propertyValue, expected))
|
||||||
getLogger().testCall("testGetBoolean", propertyName, propertyValue, expected);
|
return;
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(propertyName, propertyValue);
|
properties.setProperty(propertyName, propertyValue);
|
||||||
|
@ -96,8 +96,8 @@ class PropertiesReaderTest extends TestBase {
|
||||||
"he's a 1 but he likes 0s, 1, 1",
|
"he's a 1 but he likes 0s, 1, 1",
|
||||||
})
|
})
|
||||||
void testGetByte(String propertyName, String propertyValue, byte expected) {
|
void testGetByte(String propertyName, String propertyValue, byte expected) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetByte", propertyName, propertyValue, expected))
|
||||||
getLogger().testCall("testGetByte", propertyName, propertyValue, expected);
|
return;
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(propertyName, propertyValue);
|
properties.setProperty(propertyName, propertyValue);
|
||||||
|
@ -121,8 +121,8 @@ class PropertiesReaderTest extends TestBase {
|
||||||
"he's a 1 but he likes 0s, 1, 1",
|
"he's a 1 but he likes 0s, 1, 1",
|
||||||
})
|
})
|
||||||
void testGetShort(String propertyName, String propertyValue, short expected) {
|
void testGetShort(String propertyName, String propertyValue, short expected) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetShort", propertyName, propertyValue, expected))
|
||||||
getLogger().testCall("testGetShort", propertyName, propertyValue, expected);
|
return;
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(propertyName, propertyValue);
|
properties.setProperty(propertyName, propertyValue);
|
||||||
|
@ -147,8 +147,8 @@ class PropertiesReaderTest extends TestBase {
|
||||||
"he's a 10 but he likes 69, 10, 10",
|
"he's a 10 but he likes 69, 10, 10",
|
||||||
})
|
})
|
||||||
void testGetInteger(String propertyName, String propertyValue, int expected) {
|
void testGetInteger(String propertyName, String propertyValue, int expected) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetInteger", propertyName, propertyValue, expected))
|
||||||
getLogger().testCall("testGetInteger", propertyName, propertyValue, expected);
|
return;
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(propertyName, propertyValue);
|
properties.setProperty(propertyName, propertyValue);
|
||||||
|
@ -173,8 +173,8 @@ class PropertiesReaderTest extends TestBase {
|
||||||
"he's a 10 but he likes 69, 10, 10",
|
"he's a 10 but he likes 69, 10, 10",
|
||||||
})
|
})
|
||||||
void testGetLong(String propertyName, String propertyValue, long expected) {
|
void testGetLong(String propertyName, String propertyValue, long expected) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetLong", propertyName, propertyValue, expected))
|
||||||
getLogger().testCall("testGetLong", propertyName, propertyValue, expected);
|
return;
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(propertyName, propertyValue);
|
properties.setProperty(propertyName, propertyValue);
|
||||||
|
@ -200,8 +200,8 @@ class PropertiesReaderTest extends TestBase {
|
||||||
"he's a 10 but he likes 69, 10.69, 10.69",
|
"he's a 10 but he likes 69, 10.69, 10.69",
|
||||||
})
|
})
|
||||||
void testGetFloat(String propertyName, String propertyValue, float expected) {
|
void testGetFloat(String propertyName, String propertyValue, float expected) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetFloat", propertyName, propertyValue, expected))
|
||||||
getLogger().testCall("testGetFloat", propertyName, propertyValue, expected);
|
return;
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(propertyName, propertyValue);
|
properties.setProperty(propertyName, propertyValue);
|
||||||
|
@ -225,8 +225,8 @@ class PropertiesReaderTest extends TestBase {
|
||||||
"he's a 10 but he likes 69, 10.69, 10.69",
|
"he's a 10 but he likes 69, 10.69, 10.69",
|
||||||
})
|
})
|
||||||
void testGetDouble(String propertyName, String propertyValue, double expected) {
|
void testGetDouble(String propertyName, String propertyValue, double expected) {
|
||||||
if (isRestricted()) return;
|
if (performMethodCalls("testGetDouble", propertyName, propertyValue, expected))
|
||||||
getLogger().testCall("testGetDouble", propertyName, propertyValue, expected);
|
return;
|
||||||
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.setProperty(propertyName, propertyValue);
|
properties.setProperty(propertyName, propertyValue);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
rootProject.setName("sosengine")
|
rootProject.setName("sosengine")
|
||||||
|
|
||||||
include("base")
|
include("base")
|
||||||
|
include("testing")
|
||||||
include("ansi")
|
include("ansi")
|
||||||
include("slf4j-compat")
|
include("slf4j-compat")
|
||||||
include("windowing")
|
include("windowing")
|
||||||
|
|
112
testing/build.gradle
Normal file
112
testing/build.gradle
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||||
|
* Copyright (c) 2024 The StarOpenSource Engine Contributors
|
||||||
|
* Licensed under the GNU Affero General Public License v3
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
// Plugins
|
||||||
|
plugins {
|
||||||
|
id("java")
|
||||||
|
id("io.freefair.lombok") version("${pluginLombok}")
|
||||||
|
id("maven-publish")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Project dependencies
|
||||||
|
dependencies {
|
||||||
|
// Lombok
|
||||||
|
compileOnly("org.projectlombok:lombok:${dependencyLombok}")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:${dependencyLombok}")
|
||||||
|
|
||||||
|
// JetBrains Annotations
|
||||||
|
compileOnly("org.jetbrains:annotations:${dependencyJetbrainsAnnotations}")
|
||||||
|
|
||||||
|
// JUnit
|
||||||
|
implementation(platform("org.junit:junit-bom:${dependencyJunit}"))
|
||||||
|
implementation("org.junit.jupiter:junit-jupiter")
|
||||||
|
|
||||||
|
// -> Project <-
|
||||||
|
implementation(project(":base"))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fix delombok task
|
||||||
|
delombok.doFirst {
|
||||||
|
File target = file("${project.projectDir}/src/main/module-info.java")
|
||||||
|
File source = file("${project.projectDir}/src/main/java/module-info.java")
|
||||||
|
|
||||||
|
target.delete()
|
||||||
|
source.renameTo(target)
|
||||||
|
}
|
||||||
|
delombok.doLast {
|
||||||
|
File target = file("${project.projectDir}/src/main/java/module-info.java")
|
||||||
|
File source = file("${project.projectDir}/src/main/module-info.java")
|
||||||
|
|
||||||
|
target.delete()
|
||||||
|
source.renameTo(target)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Javadoc configuration
|
||||||
|
javadoc {
|
||||||
|
outputs.upToDateWhen { false } // Force task execution
|
||||||
|
dependsOn(delombok) // Make sure the source is delomboked first
|
||||||
|
|
||||||
|
javadoc {
|
||||||
|
setClasspath(files(project.sourceSets.main.compileClasspath)) // Include dependencies
|
||||||
|
|
||||||
|
options {
|
||||||
|
if (new File(projectDir, "src/main/javadoc/theme.css").exists())
|
||||||
|
stylesheetFile = new File(projectDir, "src/main/javadoc/theme.css") // Theming is cool :3
|
||||||
|
setMemberLevel(JavadocMemberLevel.PUBLIC) // Only display public stuff
|
||||||
|
setOverview("src/main/javadoc/overview.html") // We want a custom overview page to greet the visitor
|
||||||
|
setLocale("en_US") // 你好
|
||||||
|
addStringOption("Xwerror", "-quiet") // Fail build on warning
|
||||||
|
|
||||||
|
setJFlags([
|
||||||
|
"-Duser.language=en_US" // See above
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Include javadoc and source jar during publishing
|
||||||
|
java {
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build publishing configuration
|
||||||
|
// Note: You can safely ignore any errors or warnings thrown by your IDE here
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "staropensource"
|
||||||
|
url = uri("https://mvn.staropensource.de/sosengine")
|
||||||
|
credentials(org.gradle.api.credentials.PasswordCredentials)
|
||||||
|
authentication {
|
||||||
|
//noinspection GroovyAssignabilityCheck
|
||||||
|
basic (BasicAuthentication)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
publications {
|
||||||
|
//noinspection GroovyAssignabilityCheck
|
||||||
|
maven (MavenPublication) {
|
||||||
|
groupId = group
|
||||||
|
artifactId = project.getName()
|
||||||
|
version = version
|
||||||
|
//noinspection GroovyAssignabilityCheck
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
testing/gradle
Symbolic link
1
testing/gradle
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../gradle
|
1
testing/gradlew
vendored
Symbolic link
1
testing/gradlew
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../gradlew
|
1
testing/gradlew.bat
vendored
Symbolic link
1
testing/gradlew.bat
vendored
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../gradlew.bat
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.srctests;
|
package de.staropensource.sosengine.testing;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.Engine;
|
import de.staropensource.sosengine.base.Engine;
|
||||||
import de.staropensource.sosengine.base.EngineConfiguration;
|
import de.staropensource.sosengine.base.EngineConfiguration;
|
||||||
|
@ -25,58 +25,76 @@ import de.staropensource.sosengine.base.EngineInternals;
|
||||||
import de.staropensource.sosengine.base.type.InternalAccessArea;
|
import de.staropensource.sosengine.base.type.InternalAccessArea;
|
||||||
import de.staropensource.sosengine.base.type.Tristate;
|
import de.staropensource.sosengine.base.type.Tristate;
|
||||||
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
||||||
import de.staropensource.sosengine.unittest.UnitConfig;
|
|
||||||
import de.staropensource.sosengine.unittest.UnitLogger;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class implemented by all tests.
|
* The base class for all tests involving the StarOpenSource Engine.
|
||||||
|
* <p>
|
||||||
|
* It handles unit testing configuration, engine startups and shutdowns,
|
||||||
|
* provides a logger instance (see {@link UnitLogger}) and much more.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({ "JavadocDeclaration" })
|
||||||
public class TestBase {
|
public class TestBase {
|
||||||
/**
|
/**
|
||||||
* Instance of this test class.
|
* Contains the class instance.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the instance of this test class.
|
* Returns the class instance.
|
||||||
|
*
|
||||||
|
* @return class instance
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private static TestBase instance;
|
private static TestBase instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unit logger for this test class.
|
* Contains the {@link UnitLogger} for this instance.
|
||||||
|
*
|
||||||
|
* @see UnitLogger
|
||||||
|
* @since v1-alpha4
|
||||||
* -- GETTER --
|
* -- GETTER --
|
||||||
* Returns the unit logger for this test class.
|
* Returns the {@link UnitLogger} for this instance.
|
||||||
|
*
|
||||||
|
* @return {@link UnitLogger} instance
|
||||||
|
* @see UnitLogger
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private final UnitLogger logger = new UnitLogger(getClass());
|
private final UnitLogger logger = new UnitLogger(getClass());
|
||||||
|
|
||||||
/**
|
|
||||||
* Controls whether the engine should be automatically initialized or not.
|
|
||||||
*/
|
|
||||||
protected boolean doInitialization = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the test control mode.
|
* Contains the test control mode.
|
||||||
* Can be {@link Tristate#TRUE} for force-enable, {@link Tristate#FALSE} for force-disable or {@link Tristate#UNSET} for no test execution control.
|
* Can be {@link Tristate#TRUE} for force-enable, {@link Tristate#FALSE} for force-disable or {@link Tristate#UNSET} for no test execution control.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
protected @NotNull Tristate controlMode = Tristate.UNSET;
|
private @NotNull Tristate controlMode = Tristate.UNSET;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all class names which should be enabled/disabled during testing.
|
* Contains all class names which should be enabled/disabled during testing.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
protected @NotNull Set<@NotNull String> controlClasses = new HashSet<>();
|
private final @NotNull Set<@NotNull String> controlClasses = new HashSet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether to print a warning when a restricted class is instructed to run it's tests.
|
* Determines whether to issue a warning when a restricted test method is invoked.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
protected boolean controlWarning;
|
private boolean controlWarning;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public TestBase() {
|
public TestBase() {
|
||||||
// JUnit for some reason recreates the test class every time a test method is called
|
// JUnit for some reason recreates the test class every time a test method is called
|
||||||
|
@ -88,9 +106,11 @@ public class TestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads the system properties and configures the environment appropriately.
|
* Configures the testing environment.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public void configureEnvironment() {
|
private void configureEnvironment() {
|
||||||
for (Object propertyObject : System.getProperties().keySet()) {
|
for (Object propertyObject : System.getProperties().keySet()) {
|
||||||
String property = (String) propertyObject;
|
String property = (String) propertyObject;
|
||||||
|
|
||||||
|
@ -131,9 +151,58 @@ public class TestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows specifying that only some tests are executed.
|
* Makes all the necessary calls your method likely executes upon being invoked.
|
||||||
|
* Those being:
|
||||||
|
* - {@link #isRestricted()}
|
||||||
|
* - {@link UnitLogger#testCall(String, Object...)}
|
||||||
|
* - {@link #initializeEngine()}
|
||||||
|
* <p>
|
||||||
|
* Make sure return from your test method if this method returns {@code true}.
|
||||||
|
*
|
||||||
|
* @param initializeEngine if the engine should be initialized automatically
|
||||||
|
* @param method test method name
|
||||||
|
* @param arguments test method arguments
|
||||||
|
* @return {@code true} if the test method should return
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
protected final boolean isRestricted(boolean printWarning) {
|
protected final boolean performMethodCalls(boolean initializeEngine, @NotNull String method, @NotNull Object... arguments) {
|
||||||
|
if (isRestricted())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
logger.testCall(method, arguments);
|
||||||
|
|
||||||
|
if (initializeEngine)
|
||||||
|
initializeEngine();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes all the necessary calls your method likely executes upon being invoked.
|
||||||
|
* Those being:
|
||||||
|
* - {@link #isRestricted()}
|
||||||
|
* - {@link UnitLogger#testCall(String, Object...)}
|
||||||
|
* - {@link #initializeEngine()}
|
||||||
|
* <p>
|
||||||
|
* Make sure return from your test method if this method returns {@code true}.
|
||||||
|
*
|
||||||
|
* @param method test method name
|
||||||
|
* @param arguments test method arguments
|
||||||
|
* @return {@code true} if the test method should return
|
||||||
|
* @see #performMethodCalls(boolean, String, Object...)
|
||||||
|
* @since v1-alpha4
|
||||||
|
*/
|
||||||
|
protected final boolean performMethodCalls(@NotNull String method, @NotNull Object... arguments) {
|
||||||
|
return performMethodCalls(true, method, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether the test class has been restricted.
|
||||||
|
*
|
||||||
|
* @param printWarning if a warning should be printed about the class restriction
|
||||||
|
* @return restricted status
|
||||||
|
* @since v1-alpha4
|
||||||
|
*/
|
||||||
|
public final boolean isRestricted(boolean printWarning) {
|
||||||
String className = getClass().getName().replace(getClass().getPackage().getName() + ".", "");
|
String className = getClass().getName().replace(getClass().getPackage().getName() + ".", "");
|
||||||
boolean allowed = controlMode == Tristate.TRUE && !controlClasses.contains(className)
|
boolean allowed = controlMode == Tristate.TRUE && !controlClasses.contains(className)
|
||||||
|| controlMode == Tristate.FALSE && controlClasses.contains(className);
|
|| controlMode == Tristate.FALSE && controlClasses.contains(className);
|
||||||
|
@ -145,33 +214,24 @@ public class TestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows specifying that only some tests are executed.
|
* Checks whether the test class has been restricted.
|
||||||
|
*
|
||||||
|
* @return restricted status
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
protected final boolean isRestricted() {
|
public final boolean isRestricted() {
|
||||||
return isRestricted(true);
|
return isRestricted(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes all the necessary calls your method likely executes upon being invoked.
|
* Initializes the engine.
|
||||||
* Those being:
|
* <p>
|
||||||
* - {@link #isRestricted()}
|
* HIGHLY recommended over manually invoking {@link Engine#Engine()}.
|
||||||
* - {@link UnitLogger#testCall(String, Object...)}
|
|
||||||
*
|
*
|
||||||
* Make sure return if this method returns {@code true}.
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
protected final boolean performMethodCalls(@NotNull String method, @NotNull Object... arguments) {
|
public void initializeEngine() {
|
||||||
if (isRestricted())
|
if (Engine.getInstance() == null) {
|
||||||
return true;
|
|
||||||
logger.testCall(method, arguments);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the engine before running tests.
|
|
||||||
*/
|
|
||||||
@BeforeEach
|
|
||||||
void initializeEngine() {
|
|
||||||
if (Engine.getInstance() == null && doInitialization) {
|
|
||||||
logger.diag("Initializing engine");
|
logger.diag("Initializing engine");
|
||||||
System.getProperties().setProperty("sosengine.base.loggerLevel", "crash");
|
System.getProperties().setProperty("sosengine.base.loggerLevel", "crash");
|
||||||
new Engine();
|
new Engine();
|
||||||
|
@ -182,10 +242,14 @@ public class TestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts the engine down after running tests.
|
* Shuts the engine down safely.
|
||||||
|
* <p>
|
||||||
|
* <b>DO NOT CALL METHOD THIS MANUALLY.</b>
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
@AfterAll
|
@AfterAll
|
||||||
static void shutdownEngine() {
|
protected static void shutdownEngine() {
|
||||||
if (Engine.getInstance() != null) {
|
if (Engine.getInstance() != null) {
|
||||||
System.getProperties().setProperty("sosengine.base.loggerLevel", "crash");
|
System.getProperties().setProperty("sosengine.base.loggerLevel", "crash");
|
||||||
EngineConfiguration.getInstance().loadConfiguration();
|
EngineConfiguration.getInstance().loadConfiguration();
|
|
@ -17,20 +17,20 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.staropensource.sosengine.unittest;
|
package de.staropensource.sosengine.testing;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static configuration for unit test classes.
|
* Static configuration for unit test classes.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public class UnitConfig {
|
public class UnitConfig {
|
||||||
/**
|
/**
|
||||||
* Constructs this class.
|
* Constructs this class.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public UnitConfig() {}
|
public UnitConfig() {}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class UnitConfig {
|
||||||
* Note: The log level {@code SILENT_WARNING} has been repurposed for printing test calls.
|
* Note: The log level {@code SILENT_WARNING} has been repurposed for printing test calls.
|
||||||
*
|
*
|
||||||
* @see UnitLogger
|
* @see UnitLogger
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public static LogLevel loggerLevel = LogLevel.SILENT_WARNING;
|
public static LogLevel loggerLevel = LogLevel.SILENT_WARNING;
|
||||||
}
|
}
|
|
@ -17,9 +17,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package de.staropensource.sosengine.unittest;
|
package de.staropensource.sosengine.testing;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.logging.LoggerInstance;
|
|
||||||
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
import de.staropensource.sosengine.base.type.logging.LogLevel;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
@ -31,29 +30,29 @@ import org.jetbrains.annotations.Nullable;
|
||||||
*/
|
*/
|
||||||
public class UnitLogger {
|
public class UnitLogger {
|
||||||
/**
|
/**
|
||||||
* The parent class, similar to {@link LoggerInstance}.
|
* The parent class this instance belongs to.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
private final Class<?> clazz;
|
private final Class<?> clazz;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new unit logger.
|
* Creates a new unit logger.
|
||||||
*
|
*
|
||||||
* @param clazz parent class, similar to {@link LoggerInstance}
|
* @param clazz parent class
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public UnitLogger(Class<?> clazz) {
|
public UnitLogger(Class<?> clazz) {
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a log message.
|
* Processes and prints a log message.
|
||||||
*
|
*
|
||||||
* @param level level
|
* @param level level
|
||||||
* @param message message
|
* @param message message
|
||||||
* @param additionalStuff additional arguments
|
* @param additionalStuff additional arguments
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
private void log(@NotNull LogLevel level, @NotNull String message, @Nullable Object... additionalStuff) {
|
private void log(@NotNull LogLevel level, @NotNull String message, @Nullable Object... additionalStuff) {
|
||||||
String messageSingle = message;
|
String messageSingle = message;
|
||||||
|
@ -99,7 +98,7 @@ public class UnitLogger {
|
||||||
* Prints a diagnostic message.
|
* Prints a diagnostic message.
|
||||||
*
|
*
|
||||||
* @param message message
|
* @param message message
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public void diag(@NotNull String message) {
|
public void diag(@NotNull String message) {
|
||||||
log(LogLevel.DIAGNOSTIC, message);
|
log(LogLevel.DIAGNOSTIC, message);
|
||||||
|
@ -109,7 +108,7 @@ public class UnitLogger {
|
||||||
* Prints a verbose message.
|
* Prints a verbose message.
|
||||||
*
|
*
|
||||||
* @param message message
|
* @param message message
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public void verb(@NotNull String message) {
|
public void verb(@NotNull String message) {
|
||||||
log(LogLevel.VERBOSE, message);
|
log(LogLevel.VERBOSE, message);
|
||||||
|
@ -120,17 +119,17 @@ public class UnitLogger {
|
||||||
*
|
*
|
||||||
* @param methodName name of the test method
|
* @param methodName name of the test method
|
||||||
* @param methodArgs arguments of the test method
|
* @param methodArgs arguments of the test method
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public void testCall(@NotNull String methodName, @Nullable Object... methodArgs) {
|
public void testCall(@NotNull String methodName, @Nullable Object... methodArgs) {
|
||||||
log(LogLevel.SILENT_WARNING, methodName, methodArgs);
|
log(LogLevel.SILENT_WARNING, methodName, methodArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a informational message.
|
* Prints an informational message.
|
||||||
*
|
*
|
||||||
* @param message message
|
* @param message message
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public void info(@NotNull String message) {
|
public void info(@NotNull String message) {
|
||||||
log(LogLevel.INFORMATIONAL, message);
|
log(LogLevel.INFORMATIONAL, message);
|
||||||
|
@ -140,17 +139,17 @@ public class UnitLogger {
|
||||||
* Prints a warning message.
|
* Prints a warning message.
|
||||||
*
|
*
|
||||||
* @param message message
|
* @param message message
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public void warn(@NotNull String message) {
|
public void warn(@NotNull String message) {
|
||||||
log(LogLevel.WARNING, message);
|
log(LogLevel.WARNING, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a error message.
|
* Prints an error message.
|
||||||
*
|
*
|
||||||
* @param message message
|
* @param message message
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
public void error(@NotNull String message) {
|
public void error(@NotNull String message) {
|
||||||
log(LogLevel.ERROR, message);
|
log(LogLevel.ERROR, message);
|
|
@ -18,9 +18,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classes targeted at unit tests.
|
* Contains the code required for writing tests
|
||||||
* They aim at simplifying certain aspects of unit testing.
|
* fast and efficiently in conjunction with the
|
||||||
|
* StarOpenSource Engine.
|
||||||
*
|
*
|
||||||
* @since v1-alpha0
|
* @since v1-alpha4
|
||||||
*/
|
*/
|
||||||
package de.staropensource.sosengine.unittest;
|
package de.staropensource.sosengine.testing;
|
20
testing/src/main/java/module-info.java
Normal file
20
testing/src/main/java/module-info.java
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
* StarOpenSource Engine testing tools.
|
||||||
|
*
|
||||||
|
* @since v1-alpha4
|
||||||
|
*/
|
||||||
|
module sosengine.testing {
|
||||||
|
// Dependencies
|
||||||
|
// -> Subsystems
|
||||||
|
requires transitive sosengine.base;
|
||||||
|
// -> Libraries
|
||||||
|
requires transitive static lombok;
|
||||||
|
requires transitive org.jetbrains.annotations;
|
||||||
|
requires org.junit.jupiter.api;
|
||||||
|
|
||||||
|
// API access
|
||||||
|
exports de.staropensource.sosengine.testing;
|
||||||
|
|
||||||
|
// Reflection access
|
||||||
|
opens de.staropensource.sosengine.testing;
|
||||||
|
}
|
Loading…
Reference in a new issue