Skip to content

Commit

Permalink
test : 로그인,회원가입 테스트에서 fcmToken 요소 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
13wjdgk committed Oct 31, 2023
1 parent 1aeb69c commit 0683ebf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void tearDown() {
KakaoLoginRequest request = 카카오_로그인_요청();

// when & then
assertThatThrownBy(() -> oauthLoginService.login(request, fcmToken))
assertThatThrownBy(() -> oauthLoginService.login(request))
.isInstanceOf(NonExistentUserException.class);
}

Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -201,7 +201,7 @@ void tearDown() {
KakaoLoginRequest request = 카카오_로그인_요청();

//when & then
assertThatThrownBy(() -> oauthLoginService.login(request, fcmToken))
assertThatThrownBy(() -> oauthLoginService.login(request))
.isInstanceOf(WithdrawalUserException.class);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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);
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class UserSignupServiceTest {
private UserRepository userRepository;
@Autowired
private UserFcmTokenRepository userFcmTokenRepository;
private final String fcmToken = "fcmToken";

@AfterEach
void tearDown() {
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -93,7 +92,7 @@ void tearDown() {
diseases);

//when&that
assertThatThrownBy(() -> userSignupService.signUp(signUpRequest, fcmToken))
assertThatThrownBy(() -> userSignupService.signUp(signUpRequest))
.isInstanceOf(IllegalArgumentException.class);
}

Expand All @@ -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());

Expand Down

0 comments on commit 0683ebf

Please sign in to comment.