Class MycelTesting

java.lang.Object
my.celium.org.testing.MycelTesting

public final class MycelTesting extends Object
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 Details

    • useConfigDir

      public static PlatformService useConfigDir(Path configDir)
      Runs Mycel on a headless platform (Platform.UNKNOWN, server side, no other mods loaded) whose config folder is configDir.
    • usePlatform

      public static void usePlatform(PlatformService platform)
      Runs Mycel on platform, 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.