closing context at end of test methods
This commit is contained in:
@@ -45,6 +45,7 @@ public class AsyncAnnotationBeanPostProcessorTests {
|
|||||||
context.refresh();
|
context.refresh();
|
||||||
Object target = context.getBean("target");
|
Object target = context.getBean("target");
|
||||||
assertTrue(AopUtils.isAopProxy(target));
|
assertTrue(AopUtils.isAopProxy(target));
|
||||||
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -58,9 +59,10 @@ public class AsyncAnnotationBeanPostProcessorTests {
|
|||||||
ITestBean testBean = (ITestBean) context.getBean("target");
|
ITestBean testBean = (ITestBean) context.getBean("target");
|
||||||
testBean.test();
|
testBean.test();
|
||||||
Thread mainThread = Thread.currentThread();
|
Thread mainThread = Thread.currentThread();
|
||||||
testBean.await(1000);
|
testBean.await(3000);
|
||||||
Thread asyncThread = testBean.getThread();
|
Thread asyncThread = testBean.getThread();
|
||||||
assertNotSame(mainThread, asyncThread);
|
assertNotSame(mainThread, asyncThread);
|
||||||
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -77,9 +79,10 @@ public class AsyncAnnotationBeanPostProcessorTests {
|
|||||||
context.refresh();
|
context.refresh();
|
||||||
ITestBean testBean = (ITestBean) context.getBean("target");
|
ITestBean testBean = (ITestBean) context.getBean("target");
|
||||||
testBean.test();
|
testBean.test();
|
||||||
testBean.await(1000);
|
testBean.await(3000);
|
||||||
Thread asyncThread = testBean.getThread();
|
Thread asyncThread = testBean.getThread();
|
||||||
assertTrue(asyncThread.getName().startsWith("testExecutor"));
|
assertTrue(asyncThread.getName().startsWith("testExecutor"));
|
||||||
|
context.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user