From 02613332a320b0b7467f102a0c75da3e0b7e7bab Mon Sep 17 00:00:00 2001 From: Tamas Biro Date: Tue, 10 Sep 2024 10:23:57 +0200 Subject: [PATCH] LPD-33798 Remove unnecessary private variables --- ...dConnectAuthenticationHandlerImplTest.java | 51 +++++-------------- 1 file changed, 14 insertions(+), 37 deletions(-) diff --git a/modules/apps/portal-security-sso/portal-security-sso-openid-connect-impl/src/test/java/com/liferay/portal/security/sso/openid/connect/internal/OpenIdConnectAuthenticationHandlerImplTest.java b/modules/apps/portal-security-sso/portal-security-sso-openid-connect-impl/src/test/java/com/liferay/portal/security/sso/openid/connect/internal/OpenIdConnectAuthenticationHandlerImplTest.java index 5f66614fbbb5c4..42e0aa9e89dca8 100644 --- a/modules/apps/portal-security-sso/portal-security-sso-openid-connect-impl/src/test/java/com/liferay/portal/security/sso/openid/connect/internal/OpenIdConnectAuthenticationHandlerImplTest.java +++ b/modules/apps/portal-security-sso/portal-security-sso-openid-connect-impl/src/test/java/com/liferay/portal/security/sso/openid/connect/internal/OpenIdConnectAuthenticationHandlerImplTest.java @@ -5,8 +5,6 @@ package com.liferay.portal.security.sso.openid.connect.internal; -import com.liferay.petra.function.UnsafeConsumer; -import com.liferay.portal.kernel.json.JSONObject; import com.liferay.portal.kernel.json.JSONUtil; import com.liferay.portal.test.rule.LiferayUnitTestRule; @@ -23,10 +21,6 @@ import org.mockito.Mockito; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockHttpServletResponse; -import org.springframework.mock.web.MockHttpSession; - /** * @author Tamas Biro */ @@ -41,42 +35,30 @@ public class OpenIdConnectAuthenticationHandlerImplTest { public void setUp() { _openIdConnectAuthenticationHandlerImpl = new OpenIdConnectAuthenticationHandlerImpl(); - _mockHttpServletRequest = new MockHttpServletRequest(); - _mockHttpServletResponse = new MockHttpServletResponse(); - _mockHttpSession = new MockHttpSession(); - _userIdUnsafeConsumer = new UnsafeConsumer() { - - @Override - public void accept(Long aLong) { - } - - }; } @Test public void testWhenEmailIsInJWTClaimSet() throws Exception { - _jsonObject = JSONUtil.put( - "email", "exists@test.com" - ).put( - "name", "test_account" - ).put( - "sub", "subject" - ); - - Map claims = _processClaimSet(_jsonObject.toString()); + Map claims = _processClaimSet( + JSONUtil.put( + "email", "exists@test.com" + ).put( + "name", "test_account" + ).put( + "sub", "subject" + ).toString()); Assert.assertEquals("exists@test.com", claims.get("email")); } @Test public void testWhenEmailIsNotInJWTClaimSet() throws Exception { - _jsonObject = JSONUtil.put( - "name", "test_account" - ).put( - "sub", "subject" - ); - - Map claims = _processClaimSet(_jsonObject.toString()); + Map claims = _processClaimSet( + JSONUtil.put( + "name", "test_account" + ).put( + "sub", "subject" + ).toString()); Assert.assertNull(claims.get("email")); } @@ -96,12 +78,7 @@ private Map _processClaimSet(String claimSetJSON) mockJWT); } - private JSONObject _jsonObject; - private MockHttpServletRequest _mockHttpServletRequest; - private MockHttpServletResponse _mockHttpServletResponse; - private MockHttpSession _mockHttpSession; private OpenIdConnectAuthenticationHandlerImpl _openIdConnectAuthenticationHandlerImpl; - private UnsafeConsumer _userIdUnsafeConsumer; } \ No newline at end of file