Fix flaky test in SpringSecurityPasswordValidationCallbackHandlerTest and SpringDigestPasswordValidationCallbackHandlerTest

This commit is contained in:
Jialin Shao
2020-12-01 13:19:36 -08:00
committed by GitHub
parent 14b02c8650
commit eb6da139ae
2 changed files with 6 additions and 2 deletions

View File

@@ -51,7 +51,9 @@ public class SpringSecurityPasswordValidationCallbackHandlerTest {
@BeforeEach
public void setUp() {
// add clearContext() at the beginning of each method in case {@code SecurityContextHolder} isn't clean
SecurityContextHolder.clearContext();
callbackHandler = new SpringSecurityPasswordValidationCallbackHandler();
grantedAuthority = new SimpleGrantedAuthority("ROLE_1");

View File

@@ -46,9 +46,11 @@ public class SpringDigestPasswordValidationCallbackHandlerTest {
private String password;
private PasswordValidationCallback callback;
@BeforeEach
public void setUp() {
// add clearContext() at the beginning of each method in case {@code SecurityContextHolder} isn't clean
SecurityContextHolder.clearContext();
callbackHandler = new SpringDigestPasswordValidationCallbackHandler();
userDetailsService = createMock(UserDetailsService.class);