Make sure test classes which are setting the context clear it in their tearDown methods.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user