diff --git a/junit/build.gradle b/junit/build.gradle index 656f23456..6b2b8ae9a 100644 --- a/junit/build.gradle +++ b/junit/build.gradle @@ -18,7 +18,7 @@ repositories { dependencies { api project(":") - api platform("org.junit:junit-bom:5.10.0") + api platform("org.junit:junit-bom:5.11.3") api "org.junit.jupiter:junit-jupiter-engine" implementation "org.junit.platform:junit-platform-launcher" } diff --git a/junit/src/main/java/net/fabricmc/loader/impl/junit/FabricLoaderLauncherSessionListener.java b/junit/src/main/java/net/fabricmc/loader/impl/junit/FabricLoaderLauncherSessionListener.java index 102847f4c..fa2d3ce14 100644 --- a/junit/src/main/java/net/fabricmc/loader/impl/junit/FabricLoaderLauncherSessionListener.java +++ b/junit/src/main/java/net/fabricmc/loader/impl/junit/FabricLoaderLauncherSessionListener.java @@ -31,12 +31,20 @@ public class FabricLoaderLauncherSessionListener implements LauncherSessionListe System.setProperty(SystemProperties.UNIT_TEST, "true"); } - private final Knot knot; - private final ClassLoader classLoader; + private static Knot knot = null; + private static ClassLoader classLoader = null; private ClassLoader launcherSessionClassLoader; public FabricLoaderLauncherSessionListener() { + setup(); + } + + private static synchronized void setup() { + if (knot != null) { + return; + } + final Thread currentThread = Thread.currentThread(); final ClassLoader originalClassLoader = currentThread.getContextClassLoader();