1
0
mirror of synced 2026-08-05 09:47:05 +00:00

Make sure test classes which are setting the context clear it in their tearDown methods.

This commit is contained in:
Luke Taylor
2007-09-11 14:13:50 +00:00
parent c56b8c4117
commit 6a6bafa219
16 changed files with 89 additions and 135 deletions
@@ -44,7 +44,6 @@ public class BankTests extends TestCase {
//~ Constructors ===================================================================================================
public BankTests() {
super();
}
public BankTests(String arg0) {
@@ -53,6 +52,16 @@ public class BankTests extends TestCase {
//~ Methods ========================================================================================================
public final void setUp() throws Exception {
super.setUp();
ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
service = (BankService) ctx.getBean("bankService");
}
public void tearDown() {
SecurityContextHolder.clearContext();
}
private static void createSecureContext() {
TestingAuthenticationToken auth = new TestingAuthenticationToken("test", "test",
new GrantedAuthority[] {
@@ -66,16 +75,6 @@ public class BankTests extends TestCase {
SecurityContextHolder.setContext(new SecurityContextImpl());
}
public static void main(String[] args) {
junit.textui.TestRunner.run(BankTests.class);
}
public final void setUp() throws Exception {
super.setUp();
ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
service = (BankService) ctx.getBean("bankService");
}
public void testDeniedAccess() throws Exception {
createSecureContext();
@@ -20,6 +20,10 @@ public class DmsIntegrationTests extends AbstractTransactionalDataSourceSpringCo
return new String[] {"classpath:applicationContext-dms-shared.xml", "classpath:applicationContext-dms-insecure.xml"};
}
public void tearDown() {
SecurityContextHolder.clearContext();
}
public void setDocumentDao(DocumentDao documentDao) {
this.documentDao = documentDao;
}