Class ExpectedToFailExtension
java.lang.Object
org.junitpioneer.jupiter.ExpectedToFailExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.InvocationInterceptor
class ExpectedToFailExtension
extends Object
implements org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.InvocationInterceptor
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ExpectedToFailgetExpectedToFailAnnotation(org.junit.jupiter.api.extension.ExtensionContext context) voidinterceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) private static voidinvokeAndInvertResult(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ExtensionContext extensionContext) private static booleanReturns whether the exception should be preserved and reported as is instead of considering it an 'expected to fail' exception.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptDynamicTest, interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestTemplateMethod
-
Constructor Details
-
ExpectedToFailExtension
ExpectedToFailExtension()
-
-
Method Details
-
interceptTestMethod
public void interceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws Throwable - Specified by:
interceptTestMethodin interfaceorg.junit.jupiter.api.extension.InvocationInterceptor- Throws:
Throwable
-
invokeAndInvertResult
-
shouldPreserveException
Returns whether the exception should be preserved and reported as is instead of considering it an 'expected to fail' exception.This method is used for exceptions that abort test execution and should have higher precedence than aborted exceptions thrown by this extension.
-
getExpectedToFailAnnotation
private static ExpectedToFail getExpectedToFailAnnotation(org.junit.jupiter.api.extension.ExtensionContext context)
-