Skip to content

Commit 8128831

Browse files
committed
sonar finding on field naming convention
1 parent dba128e commit 8128831

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
class Oauth2LoginSuccessHandlerTest {
4141

4242
private final int ID = 1111111111;
43-
private final String USERNAME = "johndoe";
43+
private final String username = "johndoe";
4444

4545
@Mock
4646
private UserRepo userRepo;
@@ -65,8 +65,7 @@ void authenticateGithubUser() throws Exception {
6565
}
6666

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

7170
MockHttpServletResponse response = new MockHttpServletResponse();
7271
oAuthHandler.onAuthenticationSuccess(new MockHttpServletRequest(), response, oAuthToken);
@@ -79,7 +78,7 @@ private Entry<OAuth2AuthenticationToken, OAuth2User> mockAuthentication(String p
7978
OAuth2AuthenticationToken oauthToken = mock(OAuth2AuthenticationToken.class);
8079
OAuth2User principal = mock(OAuth2User.class);
8180
Map<String, Object> attributes = new HashMap<>();
82-
attributes.put("name", USERNAME);
81+
attributes.put("name", username);
8382
attributes.put("userID", ID);
8483
Collection<GrantedAuthority> authorities = List.of(new SimpleGrantedAuthority("ROLE_USER"));
8584
OAuth2User user = new DefaultOAuth2User(authorities, attributes, "name");

0 commit comments

Comments
 (0)