From 0683ebf9d37828a349548b911272258e1128dbb2 Mon Sep 17 00:00:00 2001 From: 13wjdgk <13wjdgk@naver.com> Date: Tue, 31 Oct 2023 19:43:11 +0900 Subject: [PATCH] =?UTF-8?q?test=20:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8,?= =?UTF-8?q?=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=EC=97=90=EC=84=9C=20fcmToken=20=EC=9A=94=EC=86=8C=20?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/LoginControllerTest.java | 4 +-- .../auth/service/OauthLoginServiceTest.java | 8 ++--- .../user/controller/SignupControllerTest.java | 30 +++++++++---------- .../user/service/UserSignupServiceTest.java | 9 +++--- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/test/java/com/coniverse/dangjang/domain/auth/controller/LoginControllerTest.java b/src/test/java/com/coniverse/dangjang/domain/auth/controller/LoginControllerTest.java index f8db2d98..c087c335 100644 --- a/src/test/java/com/coniverse/dangjang/domain/auth/controller/LoginControllerTest.java +++ b/src/test/java/com/coniverse/dangjang/domain/auth/controller/LoginControllerTest.java @@ -36,7 +36,7 @@ class LoginControllerTest extends ControllerTest { AuthToken authToken = new AuthToken(); authToken.setAccessToken("accessToken"); authToken.setRefreshToken("refreshToken"); - given(oauthLoginService.login(any(), any())).willReturn(response); + given(oauthLoginService.login(any())).willReturn(response); given(oauthLoginService.getAuthToken(any())).willReturn(authToken.getAccessToken()); // when @@ -77,7 +77,7 @@ class LoginControllerTest extends ControllerTest { AuthToken authToken = new AuthToken(); authToken.setAccessToken("accessToken"); authToken.setRefreshToken("refreshToken"); - given(oauthLoginService.login(any(), any())).willReturn(response); + given(oauthLoginService.login(any())).willReturn(response); given(oauthLoginService.getAuthToken(any())).willReturn(authToken.getAccessToken()); // when diff --git a/src/test/java/com/coniverse/dangjang/domain/auth/service/OauthLoginServiceTest.java b/src/test/java/com/coniverse/dangjang/domain/auth/service/OauthLoginServiceTest.java index fb2d5998..bd1bb989 100644 --- a/src/test/java/com/coniverse/dangjang/domain/auth/service/OauthLoginServiceTest.java +++ b/src/test/java/com/coniverse/dangjang/domain/auth/service/OauthLoginServiceTest.java @@ -67,7 +67,7 @@ void tearDown() { KakaoLoginRequest request = 카카오_로그인_요청(); // when & then - assertThatThrownBy(() -> oauthLoginService.login(request, fcmToken)) + assertThatThrownBy(() -> oauthLoginService.login(request)) .isInstanceOf(NonExistentUserException.class); } @@ -80,7 +80,7 @@ void tearDown() { KakaoLoginRequest request = 카카오_로그인_요청(); int tokenCount = 0; //when - LoginResponse response = oauthLoginService.login(request, fcmToken); + LoginResponse response = oauthLoginService.login(request); //then assertAll( @@ -100,7 +100,7 @@ void tearDown() { KakaoLoginRequest request = 카카오_로그인_요청(); int tokenCount = 0; //when - LoginResponse response = oauthLoginService.login(request, fcmToken); + LoginResponse response = oauthLoginService.login(request); //then assertAll( @@ -201,7 +201,7 @@ void tearDown() { KakaoLoginRequest request = 카카오_로그인_요청(); //when & then - assertThatThrownBy(() -> oauthLoginService.login(request, fcmToken)) + assertThatThrownBy(() -> oauthLoginService.login(request)) .isInstanceOf(WithdrawalUserException.class); } diff --git a/src/test/java/com/coniverse/dangjang/domain/user/controller/SignupControllerTest.java b/src/test/java/com/coniverse/dangjang/domain/user/controller/SignupControllerTest.java index 3bc84745..7a7b25b2 100644 --- a/src/test/java/com/coniverse/dangjang/domain/user/controller/SignupControllerTest.java +++ b/src/test/java/com/coniverse/dangjang/domain/user/controller/SignupControllerTest.java @@ -48,7 +48,7 @@ class SignupControllerTest extends ControllerTest { AuthToken authToken = new AuthToken(); authToken.setAccessToken("accessToken"); authToken.setRefreshToken("refreshToken"); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); given(oauthLoginService.getAuthToken(loginResponse.nickname())).willReturn(authToken.getAccessToken()); String content = objectMapper.writeValueAsString(signUpRequest); @@ -73,7 +73,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -96,7 +96,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -118,7 +118,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -141,7 +141,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -163,7 +163,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when ResultActions resultActions = post(mockMvc, URI, content); @@ -184,7 +184,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -206,7 +206,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -228,7 +228,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -250,7 +250,7 @@ class SignupControllerTest extends ControllerTest { null, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -272,7 +272,7 @@ class SignupControllerTest extends ControllerTest { false, -1, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -294,7 +294,7 @@ class SignupControllerTest extends ControllerTest { false, 0, null, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -316,7 +316,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, null, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -338,7 +338,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, diseases); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when @@ -358,7 +358,7 @@ class SignupControllerTest extends ControllerTest { false, 0, false, false, null); LoginResponse loginResponse = new LoginResponse("test", false, false); - given(userSignupService.signUp(any(), any())).willReturn(loginResponse); + given(userSignupService.signUp(any())).willReturn(loginResponse); String content = objectMapper.writeValueAsString(signUpRequest); // when diff --git a/src/test/java/com/coniverse/dangjang/domain/user/service/UserSignupServiceTest.java b/src/test/java/com/coniverse/dangjang/domain/user/service/UserSignupServiceTest.java index f9bcce96..c0180a90 100644 --- a/src/test/java/com/coniverse/dangjang/domain/user/service/UserSignupServiceTest.java +++ b/src/test/java/com/coniverse/dangjang/domain/user/service/UserSignupServiceTest.java @@ -39,7 +39,6 @@ class UserSignupServiceTest { private UserRepository userRepository; @Autowired private UserFcmTokenRepository userFcmTokenRepository; - private final String fcmToken = "fcmToken"; @AfterEach void tearDown() { @@ -57,7 +56,7 @@ void tearDown() { diseases); // when - LoginResponse loginResponse = userSignupService.signUp(signUpRequest, fcmToken); + LoginResponse loginResponse = userSignupService.signUp(signUpRequest); // that assertThat(loginResponse.nickname()).isEqualTo(signUpRequest.nickname()); @@ -75,7 +74,7 @@ void tearDown() { diseases); // when - LoginResponse loginResponse = userSignupService.signUp(signUpRequest, fcmToken); + LoginResponse loginResponse = userSignupService.signUp(signUpRequest); // that assertThat(loginResponse.nickname()).isEqualTo(signUpRequest.nickname()); @@ -93,7 +92,7 @@ void tearDown() { diseases); //when&that - assertThatThrownBy(() -> userSignupService.signUp(signUpRequest, fcmToken)) + assertThatThrownBy(() -> userSignupService.signUp(signUpRequest)) .isInstanceOf(IllegalArgumentException.class); } @@ -105,7 +104,7 @@ void tearDown() { SignUpRequest signUpRequest = SignUpFixture.getSignUpRequest("287873365589", "test", "naver", true, LocalDate.parse("2021-06-21"), 150, 50, "MEDIUM", false, 0, false, false, diseases); - userSignupService.signUp(signUpRequest, fcmToken); + userSignupService.signUp(signUpRequest); //when DuplicateNicknameResponse isDuplicated = userSignupService.checkDuplicatedNickname(signUpRequest.nickname());