AutoCloseExtension is a JUnit Jupiter extension that closes resources
if a field in a test class is annotated with @AutoClose.
Consult the Javadoc for @AutoClose for details on the contract.
AutoClose
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterAll(ExtensionContext context)
Implements org. Callback that is invoked once after all tests in the current container. |
| private static void | |
| private static void | |
| private static void | closeFields(Class<?> testClass, @Nullable Object testInstance, ThrowableCollector throwableCollector)
|
| private static String | |
| private static void | |
| public void | preDestroyTestInstance(ExtensionContext context)
Implements org. Callback for processing test instances before they are destroyed. |
| logger | back to summary |
|---|---|
| private static final Logger logger | |
| AutoCloseExtension | back to summary |
|---|---|
| pack-priv AutoCloseExtension() | |
| afterAll | back to summary |
|---|---|
| public void afterAll(ExtensionContext context) Implements org. Doc from org. Callback that is invoked once after all tests in the current container.
| |
| checkCondition | back to summary |
|---|---|
| private static void checkCondition(boolean condition, String messageFormat, Field field) | |
| closeField | back to summary |
|---|---|
| private static void closeField(Field field, @Nullable Object testInstance) throws Exception | |
| closeFields | back to summary |
|---|---|
| private static void closeFields(Class<?> testClass, @Nullable Object testInstance, ThrowableCollector throwableCollector) | |
| getQualifiedName | back to summary |
|---|---|
| private static String getQualifiedName(Field field) | |
| invokeCloseMethod | back to summary |
|---|---|
| private static void invokeCloseMethod(Field field, Object target, String methodName) throws Exception | |
| preDestroyTestInstance | back to summary |
|---|---|
| public void preDestroyTestInstance(ExtensionContext context) Implements org. Doc from org. Callback for processing test instances before they are destroyed. Contrary to
| |