Package org.spongepowered.mij
Class ModLauncherExtension
java.lang.Object
org.spongepowered.mij.ModLauncherExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.InvocationInterceptor,MethodInvocationInterceptor
A JUnit extension booting ModLauncher and executing tests inside the transforming class loader.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<?>getTransformedClass(Class<?> originalClass) protected Constructor<?>getTransformedConstructor(Constructor<?> originalConstructor) protected ObjectgetTransformedInstance(Object originalInstance) protected MethodgetTransformedMethod(Method originalMethod) protected abstract ClassLoaderGets the transforming class loader in which tests are executed.<T> TinterceptMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Intercepts the invocation of any method.<T> TinterceptTestClassConstructor(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Constructor<T>> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptDynamicTest, interceptDynamicTestMethods inherited from interface org.spongepowered.mij.MethodInvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptTestFactoryMethod, interceptTestMethod, interceptTestTemplateMethod
-
Constructor Details
-
ModLauncherExtension
public ModLauncherExtension()
-
-
Method Details
-
interceptTestClassConstructor
public <T> T interceptTestClassConstructor(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Constructor<T>> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptTestClassConstructorin interfaceorg.junit.jupiter.api.extension.InvocationInterceptor- Throws:
Throwable
-
interceptMethod
public <T> T interceptMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable Description copied from interface:MethodInvocationInterceptorIntercepts the invocation of any method.- Specified by:
interceptMethodin interfaceMethodInvocationInterceptor- Parameters:
invocation- The invocation that is being intercepted; nevernullinvocationContext- The context of the invocation that is being intercepted; nevernullextensionContext- The current extension context; nevernull- Throws:
Throwable- In case of failures
-
getTransformedInstance
-
getTransformedConstructor
-
getTransformedMethod
-
getTransformedClass
-
getTransformingClassLoader
Gets the transforming class loader in which tests are executed. A typical implementation of this method will invokeSharedModLauncher.getTransformingClassLoader(String[])with the launch target set in the arguments.- Returns:
- The transforming class loader
-