- 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 java.lang.Object implements org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.InvocationInterceptor
-
-
Constructor Summary
Constructors Constructor Description ExpectedToFailExtension()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static ExpectedToFailgetExpectedToFailAnnotation(org.junit.jupiter.api.extension.ExtensionContext context)voidinterceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)private static voidinvokeAndInvertResult(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ExtensionContext extensionContext)private static booleanshouldPreserveException(java.lang.Throwable t)Returns whether the exception should be preserved and reported as is instead of considering it an 'expected to fail' exception.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor
interceptAfterAllMethod, interceptAfterEachMethod, interceptBeforeAllMethod, interceptBeforeEachMethod, interceptDynamicTest, interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod, interceptTestTemplateMethod
-
-
-
-
Method Detail
-
interceptTestMethod
public void interceptTestMethod(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<java.lang.reflect.Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Throwable- Specified by:
interceptTestMethodin interfaceorg.junit.jupiter.api.extension.InvocationInterceptor- Throws:
java.lang.Throwable
-
invokeAndInvertResult
private static void invokeAndInvertResult(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<java.lang.Void> invocation, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws java.lang.Throwable- Throws:
java.lang.Throwable
-
shouldPreserveException
private static boolean shouldPreserveException(java.lang.Throwable t)
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)
-
-