Call SecurityContextHolder.clearContext() in tear down of HttpSessionSecurityContextRepositoryTests

This commit is contained in:
Rob Winch 2011-12-30 14:30:17 -06:00
parent 3679227b11
commit 21f2991ab4

View File

@ -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 {