Top Inners Fields Constructors Methods
org.junit.jupiter.migrationsupport.rules

pack-priv Class TestRuleSupport

extends Object
implements BeforeEachCallback, TestExecutionExceptionHandler, AfterEachCallback
Class Inheritance
All Implemented Interfaces
org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.TestExecutionExceptionHandler, org.junit.jupiter.api.extension.BeforeEachCallback
Static Imports
java.util.Collections.unmodifiableList, org.junit.platform.commons.support.AnnotationSupport.findPublicAnnotatedFields, .AnnotationSupport.isAnnotated, .HierarchyTraversalMode.TOP_DOWN, .ReflectionSupport.findMethods

Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface

Field Summary

Modifier and TypeField and Description
private final Function<TestRuleAnnotatedMember, AbstractTestRuleAdapter>
private final Class<? extends TestRule>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
afterEach(ExtensionContext context)

Implements org.junit.jupiter.api.extension.AfterEachCallback.afterEach.

Callback that is invoked after an individual test and any user-defined teardown methods for that test have been executed.

public void
beforeEach(ExtensionContext context)

Implements org.junit.jupiter.api.extension.BeforeEachCallback.beforeEach.

Callback that is invoked before an individual test and any user-defined setup methods for that test have been executed.

private List<Field>
private List<Method>
private List<TestRuleAnnotatedMember>
private List<TestRuleAnnotatedMember>

Returns:

a modifiable copy of the list of rule-annotated members
getRuleAnnotatedMembers
(ExtensionContext context)

public void
private int

Returns:

the number of appropriate rule-annotated members that were discovered
invokeAppropriateMethodOnRuleAnnotatedMembers
(ExtensionContext context, boolean reverseOrder, TestRuleSupport.AdviceInvoker adviceInvoker)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

adapterGeneratorback to summary
private final Function<TestRuleAnnotatedMember, AbstractTestRuleAdapter> adapterGenerator
ruleTypeback to summary
private final Class<? extends TestRule> ruleType

Constructor Detail

TestRuleSupportback to summary
pack-priv TestRuleSupport(Function<TestRuleAnnotatedMember, AbstractTestRuleAdapter> adapterGenerator, Class<? extends TestRule> ruleType)

Method Detail

afterEachback to summary
public void afterEach(ExtensionContext context)

Implements org.junit.jupiter.api.extension.AfterEachCallback.afterEach.

Doc from org.junit.jupiter.api.extension.AfterEachCallback.afterEach.

Callback that is invoked after an individual test and any user-defined teardown methods for that test have been executed.

Annotations
@Override
beforeEachback to summary
public void beforeEach(ExtensionContext context)

Implements org.junit.jupiter.api.extension.BeforeEachCallback.beforeEach.

Doc from org.junit.jupiter.api.extension.BeforeEachCallback.beforeEach.

Callback that is invoked before an individual test and any user-defined setup methods for that test have been executed.

Annotations
@Override
findAnnotatedFieldsback to summary
private List<Field> findAnnotatedFields(Object testInstance)
findAnnotatedMethodsback to summary
private List<Method> findAnnotatedMethods(Object testInstance)
findRuleAnnotatedMembersback to summary
private List<TestRuleAnnotatedMember> findRuleAnnotatedMembers(Object testInstance)
Annotations
@SuppressWarnings:JavadocReference
See Also
org.junit.runners.BlockJUnit4ClassRunner#withRules, org.junit.rules.RunRules
getRuleAnnotatedMembersback to summary
private List<TestRuleAnnotatedMember> getRuleAnnotatedMembers(ExtensionContext context)
Returns:List<TestRuleAnnotatedMember>

a modifiable copy of the list of rule-annotated members

Annotations
@SuppressWarnings:unchecked
handleTestExecutionExceptionback to summary
public void handleTestExecutionException(ExtensionContext context, Throwable throwable) throws Throwable

Implements org.junit.jupiter.api.extension.TestExecutionExceptionHandler.handleTestExecutionException.

Doc from org.junit.jupiter.api.extension.TestExecutionExceptionHandler.handleTestExecutionException.

Handle the supplied throwable.

Implementors must perform one of the following.

  1. Swallow the supplied throwable, thereby preventing propagation.
  2. Rethrow the supplied throwable as is.
  3. Throw a new exception, potentially wrapping the supplied throwable.

If the supplied throwable is swallowed, subsequent TestExecutionExceptionHandlers will not be invoked; otherwise, the next registered TestExecutionExceptionHandler (if there is one) will be invoked with any Throwable thrown by this handler.

Note that the execution exception in the supplied ExtensionContext will not contain the Throwable thrown during invocation of the corresponding @Test method.

Annotations
@Override
invokeAppropriateMethodOnRuleAnnotatedMembersback to summary
private int invokeAppropriateMethodOnRuleAnnotatedMembers(ExtensionContext context, boolean reverseOrder, TestRuleSupport.AdviceInvoker adviceInvoker)
Returns:int

the number of appropriate rule-annotated members that were discovered

org.junit.jupiter.migrationsupport.rules back to summary

private Interface TestRuleSupport.AdviceInvoker

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public void
public default void

Method Detail

invokeback to summary
public void invoke(GenericBeforeAndAfterAdvice advice) throws Throwable
invokeAndMaskCheckedExceptionsback to summary
public default void invokeAndMaskCheckedExceptions(GenericBeforeAndAfterAdvice advice)