Skip to content

Commit bca6325

Browse files
committed
Small refactor
1 parent 5f54e39 commit bca6325

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/test/java/com/faforever/api/user/SteamServiceTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ class SteamServiceTest {
2929
private static final String DUMMY_RESPONSE = "dummy response";
3030
@Mock
3131
private AccountLinkRepository accountLinkRepositoryMock;
32+
@Mock
33+
private HttpServletRequest requestMock;
3234
@InjectMocks
3335
private SteamService beanUnderTest;
3436

3537
@Test
3638
void testHandleInvalidOpenIdRedirect() {
37-
HttpServletRequest requestMock = Mockito.mock(HttpServletRequest.class);
3839
when(requestMock.getParameterMap())
3940
.thenReturn(Map.of(IDENTITY_NAME_PARAM, new String[]{DUMMY_URL}));
4041
when(requestMock.getParameter(IDENTITY_NAME_PARAM)).thenReturn(DUMMY_URL);
@@ -47,7 +48,6 @@ void testHandleInvalidOpenIdRedirect() {
4748

4849
@Test
4950
void testHandleInvalidOpenIdRedirectBlankIdentityParam() {
50-
HttpServletRequest requestMock = Mockito.mock(HttpServletRequest.class);
5151
final String blankDummyUrl = "";
5252
when(requestMock.getParameterMap())
5353
.thenReturn(Map.of(IDENTITY_NAME_PARAM, new String[]{blankDummyUrl}));
@@ -61,7 +61,6 @@ void testHandleInvalidOpenIdRedirectBlankIdentityParam() {
6161

6262
@Test
6363
void testHandleInvalidOpenIdRedirectNoIdentityInRequest() {
64-
HttpServletRequest requestMock = Mockito.mock(HttpServletRequest.class);
6564
when(requestMock.getParameterMap()).thenReturn(Collections.emptyMap());
6665

6766
ApiException thrownException = assertThrows(ApiException.class,
@@ -72,7 +71,6 @@ void testHandleInvalidOpenIdRedirectNoIdentityInRequest() {
7271

7372
@Test
7473
void testHandleInvalidOpenIdRedirectLinkedAccountExists() {
75-
HttpServletRequest requestMock = Mockito.mock(HttpServletRequest.class);
7674
User userMock = Mockito.mock(User.class);
7775
when(userMock.getId()).thenReturn(1);
7876
when(userMock.getLogin()).thenReturn("dummyLogin");

0 commit comments

Comments
 (0)