Skip to content

Commit 79cbaba

Browse files
committed
remove unused parameter
1 parent 2c5ba0e commit 79cbaba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

server/src/test/java/dev/findfirst/security/oauth2/Oauth2LoginSuccessHandlerTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.findfirst.security.oauth2;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
4-
import static org.junit.jupiter.api.Assertions.assertTrue;
4+
import static org.junit.jupiter.api.Assertions.assertNotNull;
55
import static org.mockito.Mockito.mock;
66
import static org.mockito.Mockito.when;
77

@@ -39,7 +39,7 @@
3939
@ExtendWith(MockitoExtension.class)
4040
class Oauth2LoginSuccessHandlerTest {
4141

42-
private final int ID = 1111111111;
42+
private final int id = 1111111111;
4343
private final String username = "johndoe";
4444

4545
@Mock
@@ -65,21 +65,21 @@ void authenticateGithubUser() throws Exception {
6565
}
6666

6767
private void authenticateUserByProvider(String provider) throws Exception {
68-
OAuth2AuthenticationToken oAuthToken = mockAuthentication(provider.toLowerCase(), ID).getFirst();
68+
OAuth2AuthenticationToken oAuthToken = mockAuthentication(provider.toLowerCase()).getFirst();
6969

7070
MockHttpServletResponse response = new MockHttpServletResponse();
7171
oAuthHandler.onAuthenticationSuccess(new MockHttpServletRequest(), response, oAuthToken);
7272

73-
assertTrue(response.getHeader("Set-Cookie") != null);
73+
assertNotNull(response.getHeader("Set-Cookie"));
7474
assertEquals("localhost/account/login/oauth2", response.getRedirectedUrl());
7575
}
7676

77-
private Entry<OAuth2AuthenticationToken, OAuth2User> mockAuthentication(String provider, int id) {
77+
private Entry<OAuth2AuthenticationToken, OAuth2User> mockAuthentication(String provider) {
7878
OAuth2AuthenticationToken oauthToken = mock(OAuth2AuthenticationToken.class);
7979
OAuth2User principal = mock(OAuth2User.class);
8080
Map<String, Object> attributes = new HashMap<>();
8181
attributes.put("name", username);
82-
attributes.put("userID", ID);
82+
attributes.put("userID", id);
8383
Collection<GrantedAuthority> authorities = List.of(new SimpleGrantedAuthority("ROLE_USER"));
8484
OAuth2User user = new DefaultOAuth2User(authorities, attributes, "name");
8585
when(oauthToken.getPrincipal()).thenReturn(user);

0 commit comments

Comments
 (0)