Polishing

1. fix deprecations
2. fix generics
3. use lambda instead of anonymous class
4. mark some fields as final
This commit is contained in:
Yanming Zhou
2023-08-23 10:39:53 +08:00
committed by Marcus Hert Da Coregio
parent 831d65a97c
commit 11ce4b4561
18 changed files with 96 additions and 98 deletions

View File

@@ -30,6 +30,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.quality.Strictness;
import org.springframework.security.core.AuthenticatedPrincipal;
import org.springframework.security.core.Authentication;
@@ -154,7 +155,7 @@ class SpringSessionBackedSessionRegistryTest {
private Session createSession(String sessionId, String userName, Instant lastAccessed) {
MapSession session = new MapSession(sessionId);
session.setLastAccessedTime(lastAccessed);
Authentication authentication = mock(Authentication.class, withSettings().lenient());
Authentication authentication = mock(Authentication.class, withSettings().strictness(Strictness.LENIENT));
given(authentication.getName()).willReturn(userName);
SecurityContextImpl securityContext = new SecurityContextImpl();
securityContext.setAuthentication(authentication);

View File

@@ -39,7 +39,7 @@ class OnCommittedResponseWrapperTests {
private static final String NL = "\r\n";
@Mock(lenient = true)
@Mock(strictness = Mock.Strictness.LENIENT)
HttpServletResponse delegate;
@Mock

View File

@@ -47,7 +47,7 @@ import static org.mockito.Mockito.verify;
@ExtendWith(MockitoExtension.class)
class SpringSessionWebSessionStoreTests<S extends Session> {
@Mock(lenient = true)
@Mock(strictness = Mock.Strictness.LENIENT)
private ReactiveSessionRepository<S> sessionRepository;
@Mock

View File

@@ -48,13 +48,13 @@ import static org.mockito.Mockito.verify;
@ExtendWith(MockitoExtension.class)
class WebSocketRegistryListenerTests {
@Mock(lenient = true)
@Mock(strictness = Mock.Strictness.LENIENT)
private WebSocketSession wsSession;
@Mock(lenient = true)
@Mock(strictness = Mock.Strictness.LENIENT)
private WebSocketSession wsSession2;
@Mock(lenient = true)
@Mock(strictness = Mock.Strictness.LENIENT)
private Message<byte[]> message;
@Mock

View File

@@ -55,7 +55,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
@ExtendWith(MockitoExtension.class)
class SessionRepositoryMessageInterceptorTests {
@Mock(lenient = true)
@Mock(strictness = Mock.Strictness.LENIENT)
SessionRepository<Session> sessionRepository;
@Mock