Class MycelTesting
java.lang.Object
my.celium.org.testing.MycelTesting
Support for headless unit tests of mods built on Mycel: no loader, no game.
@BeforeAll
static void boot(@TempDir Path dir) {
MycelTesting.useConfigDir(dir); // config/*.json go to the temp dir
MyMod.init();
}
Call it before the first Mycel call of the test JVM. Never call it from mod code that runs in the game.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidreset()Forgets the test platform; the next Mycel call looks for a real one again.static PlatformServiceuseConfigDir(Path configDir) Runs Mycel on a headless platform (Platform.UNKNOWN, server side, no other mods loaded) whose config folder isconfigDir.static voidusePlatform(PlatformService platform) Runs Mycel onplatform, for tests that need more control (e.g.
-
Method Details
-
useConfigDir
Runs Mycel on a headless platform (Platform.UNKNOWN, server side, no other mods loaded) whose config folder isconfigDir. -
usePlatform
Runs Mycel onplatform, for tests that need more control (e.g.isModLoaded). -
reset
public static void reset()Forgets the test platform; the next Mycel call looks for a real one again.
-