/** * Delegates to {@link TestContextManager#beforeTestClass}. */ @Override public void beforeAll(ExtensionContext context) throws Exception { getTestContextManager(context).beforeTestClass(); }
/** * Delegates to {@link TestContextManager#prepareTestInstance}. */ @Override public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception { getTestContextManager(context).prepareTestInstance(testInstance); }
/** * Get the {@link ApplicationContext} associated with the supplied {@code ExtensionContext}. * @param context the current {@code ExtensionContext} (never {@code null}) * @return the application context * @throws IllegalStateException if an error occurs while retrieving the application context * @see org.springframework.test.context.TestContext#getApplicationContext() */ public static ApplicationContext getApplicationContext(ExtensionContext context) { return getTestContextManager(context).getTestContext().getApplicationContext(); }
/** * Delegates to {@link TestContextManager#beforeTestExecution}. */ @Override public void beforeTestExecution(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); getTestContextManager(context).beforeTestExecution(testInstance, testMethod); }
/** * Delegates to {@link TestContextManager#afterTestExecution}. */ @Override public void afterTestExecution(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); Throwable testException = context.getExecutionException().orElse(null); getTestContextManager(context).afterTestExecution(testInstance, testMethod, testException); }
/** * Delegates to {@link TestContextManager#afterTestMethod}. */ @Override public void afterEach(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); Throwable testException = context.getExecutionException().orElse(null); getTestContextManager(context).afterTestMethod(testInstance, testMethod, testException); }
/** * Delegates to {@link TestContextManager#beforeTestMethod}. */ @Override public void beforeEach(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); getTestContextManager(context).beforeTestMethod(testInstance, testMethod); }
/** * Delegates to {@link TestContextManager#afterTestClass}. */ @Override public void afterAll(ExtensionContext context) throws Exception { try { getTestContextManager(context).afterTestClass(); } finally { getStore(context).remove(context.getRequiredTestClass()); } }
/** * Delegates to {@link TestContextManager#beforeTestClass}. */ @Override public void beforeAll(ExtensionContext context) throws Exception { getTestContextManager(context).beforeTestClass(); }
/** * Delegates to {@link TestContextManager#beforeTestClass}. */ @Override public void beforeAll(ExtensionContext context) throws Exception { getTestContextManager(context).beforeTestClass(); }
/** * Delegates to {@link TestContextManager#prepareTestInstance}. */ @Override public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception { getTestContextManager(context).prepareTestInstance(testInstance); }
/** * Delegates to {@link TestContextManager#beforeTestClass}. */ @Override public void beforeAll(ExtensionContext context) throws Exception { getTestContextManager(context).beforeTestClass(); }
/** * Get the {@link ApplicationContext} associated with the supplied {@code ExtensionContext}. * @param context the current {@code ExtensionContext} (never {@code null}) * @return the application context * @throws IllegalStateException if an error occurs while retrieving the application context * @see org.springframework.test.context.TestContext#getApplicationContext() */ public static ApplicationContext getApplicationContext(ExtensionContext context) { return getTestContextManager(context).getTestContext().getApplicationContext(); }
/** * Get the {@link ApplicationContext} associated with the supplied {@code ExtensionContext}. * @param context the current {@code ExtensionContext} (never {@code null}) * @return the application context * @throws IllegalStateException if an error occurs while retrieving the application context * @see org.springframework.test.context.TestContext#getApplicationContext() */ public static ApplicationContext getApplicationContext(ExtensionContext context) { return getTestContextManager(context).getTestContext().getApplicationContext(); }
/** * Delegates to {@link TestContextManager#beforeTestMethod}. */ @Override public void beforeEach(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); getTestContextManager(context).beforeTestMethod(testInstance, testMethod); }
/** * Delegates to {@link TestContextManager#afterTestMethod}. */ @Override public void afterEach(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); Throwable testException = context.getExecutionException().orElse(null); getTestContextManager(context).afterTestMethod(testInstance, testMethod, testException); }
/** * Delegates to {@link TestContextManager#afterTestExecution}. */ @Override public void afterTestExecution(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); Throwable testException = context.getExecutionException().orElse(null); getTestContextManager(context).afterTestExecution(testInstance, testMethod, testException); }
/** * Delegates to {@link TestContextManager#beforeTestExecution}. */ @Override public void beforeTestExecution(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); getTestContextManager(context).beforeTestExecution(testInstance, testMethod); }
/** * Delegates to {@link TestContextManager#afterTestExecution}. */ @Override public void afterTestExecution(ExtensionContext context) throws Exception { Object testInstance = context.getRequiredTestInstance(); Method testMethod = context.getRequiredTestMethod(); Throwable testException = context.getExecutionException().orElse(null); getTestContextManager(context).afterTestExecution(testInstance, testMethod, testException); }
/** * Delegates to {@link TestContextManager#afterTestClass}. */ @Override public void afterAll(ExtensionContext context) throws Exception { try { getTestContextManager(context).afterTestClass(); } finally { getStore(context).remove(context.getRequiredTestClass()); } }