浏览代码

Call SecurityContextHolder.clearContext() in tear down of HttpSessionSecurityContextRepositoryTests

Rob Winch 13 年之前
父节点
当前提交
21f2991ab4

+ 6 - 0
web/src/test/java/org/springframework/security/web/context/HttpSessionSecurityContextRepositoryTests.java

@@ -3,6 +3,7 @@ package org.springframework.security.web.context;
 import static org.junit.Assert.*;
 import static org.junit.Assert.*;
 import static org.springframework.security.web.context.HttpSessionSecurityContextRepository.*;
 import static org.springframework.security.web.context.HttpSessionSecurityContextRepository.*;
 
 
+import org.junit.After;
 import org.junit.Test;
 import org.junit.Test;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 import org.springframework.mock.web.MockHttpServletResponse;
@@ -19,6 +20,11 @@ import org.springframework.security.web.context.SaveContextOnUpdateOrErrorRespon
 public class HttpSessionSecurityContextRepositoryTests {
 public class HttpSessionSecurityContextRepositoryTests {
     private final TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A");
     private final TestingAuthenticationToken testToken = new TestingAuthenticationToken("someone", "passwd", "ROLE_A");
 
 
+    @After
+    public void tearDown() {
+        SecurityContextHolder.clearContext();
+    }
+
     @Test(expected=IllegalArgumentException.class)
     @Test(expected=IllegalArgumentException.class)
     @Deprecated
     @Deprecated
     public void detectsInvalidContextClass() throws Exception {
     public void detectsInvalidContextClass() throws Exception {