testExecutionListener.beforeTestMethod(getTestContext());
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredViaMetaAnnotationOnClassAfterClass() throws Exception { Class<?> clazz = DirtiesContextDeclaredViaMetaAnnotationAfterClass.class; BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("clean")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredLocallyOnClassBeforeClass() throws Exception { Class<?> clazz = DirtiesContextDeclaredLocallyBeforeClass.class; BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("clean")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredLocallyOnMethodWithBeforeMethodMode() throws Exception { Class<?> clazz = getClass(); BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn( clazz.getDeclaredMethod("dirtiesContextDeclaredLocallyWithBeforeMethodMode")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredLocallyOnClassAfterClass() throws Exception { Class<?> clazz = DirtiesContextDeclaredLocallyAfterClass.class; BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("clean")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredLocallyOnMethodWithAfterMethodMode() throws Exception { Class<?> clazz = getClass(); BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn( clazz.getDeclaredMethod("dirtiesContextDeclaredLocallyWithAfterMethodMode")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredLocallyOnClassBeforeEachTestMethod() throws Exception { Class<?> clazz = DirtiesContextDeclaredLocallyBeforeEachTestMethod.class; BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("clean")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredOnMethodViaMetaAnnotationWithAfterMethodMode() throws Exception { Class<?> clazz = getClass(); BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn( clazz.getDeclaredMethod("dirtiesContextDeclaredViaMetaAnnotationWithAfterMethodMode")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredLocallyOnClassAfterEachTestMethod() throws Exception { Class<?> clazz = DirtiesContextDeclaredLocallyAfterEachTestMethod.class; BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("clean")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); }
@Test public void beforeAndAfterTestMethodForDirtiesContextViaMetaAnnotationWithOverrides() throws Exception { Class<?> clazz = DirtiesContextViaMetaAnnotationWithOverrides.class; BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("clean")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(CURRENT_LEVEL); }
@Test public void beforeAndAfterTestMethodForDirtiesContextDeclaredViaMetaAnnotationOnClassAfterEachTestMethod() throws Exception { Class<?> clazz = DirtiesContextDeclaredViaMetaAnnotationAfterEachTestMethod.class; BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz); given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("clean")); beforeListener.beforeTestMethod(testContext); afterListener.beforeTestMethod(testContext); verify(testContext, times(0)).markApplicationContextDirty(any(HierarchyMode.class)); afterListener.afterTestMethod(testContext); beforeListener.afterTestMethod(testContext); verify(testContext, times(1)).markApplicationContextDirty(EXHAUSTIVE); }
public void call(TestExecutionListener listener) throws Exception { listener.beforeTestMethod(testContext); } });
public void call(TestExecutionListener listener) throws Exception { listener.beforeTestMethod(testContext); } });
@Override public void beforeTestMethod(TestContext testContext) throws Exception { delegate.beforeTestMethod(testContext); }
@Override public void beforeTestMethod(TestContext testContext) throws Exception { delegate.beforeTestMethod(testContext); }
testExecutionListener.beforeTestMethod(getTestContext());
testExecutionListener.beforeTestMethod(getTestContext());