Package brave.test.util
Class ClassLoaders
- java.lang.Object
-
- brave.test.util.ClassLoaders
-
public final class ClassLoaders extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClassLoaders.ConsumerRunnable<T>
-
Constructor Summary
Constructors Constructor Description ClassLoaders()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
assertRunIsUnloadable(Class<? extends Runnable> runnable, ClassLoader parent)
Runs the type in a new classloader that recreates brave classesstatic <T> void
assertRunIsUnloadableWithSupplier(Class<? extends ClassLoaders.ConsumerRunnable<T>> assertion, Class<? extends Supplier<? extends T>> supplier)
Runs the assertion in a new classloader.static <T> T
newInstance(Class<T> type, ClassLoader loader)
Validating instance creator that ensures the supplier type is static or top-level
-
-
-
Method Detail
-
assertRunIsUnloadableWithSupplier
public static <T> void assertRunIsUnloadableWithSupplier(Class<? extends ClassLoaders.ConsumerRunnable<T>> assertion, Class<? extends Supplier<? extends T>> supplier)
Runs the assertion in a new classloader. Needed when you are creating parameterized tests
-
newInstance
public static <T> T newInstance(Class<T> type, ClassLoader loader)
Validating instance creator that ensures the supplier type is static or top-level
-
assertRunIsUnloadable
public static void assertRunIsUnloadable(Class<? extends Runnable> runnable, ClassLoader parent)
Runs the type in a new classloader that recreates brave classes
-
-