Ensure engine shutdown after running tests
This commit is contained in:
parent
6a2a18095b
commit
d1fa759d0a
1 changed files with 14 additions and 1 deletions
|
@ -20,8 +20,10 @@
|
|||
package de.staropensource.sosengine.base.srctests;
|
||||
|
||||
import de.staropensource.sosengine.base.Engine;
|
||||
import de.staropensource.sosengine.base.EngineInternals;
|
||||
import de.staropensource.sosengine.unittests.UnitLogger;
|
||||
import lombok.Getter;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import java.util.Locale;
|
||||
|
@ -92,7 +94,18 @@ public class TestBase {
|
|||
*/
|
||||
@BeforeEach
|
||||
void initializeEngine() {
|
||||
if (doInitialization && Engine.getInstance() == null)
|
||||
if (doInitialization && Engine.getInstance() == null) {
|
||||
new Engine();
|
||||
EngineInternals.getInstance().setShutdownHandler(exitCode -> {});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts the engine down after running tests.
|
||||
*/
|
||||
@AfterAll
|
||||
static void shutdownEngine() {
|
||||
if (Engine.getInstance() != null)
|
||||
Engine.getInstance().shutdown();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue