Skip to content

Commit

Permalink
refactor: 불필요한 어노테이션 삭제 및 텍스트 픽스처 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
JINU-CHANG committed Aug 3, 2024
1 parent 507cb53 commit 76426ba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

@ConfigurationPropertiesScan
@EnableJpaAuditing
@SpringBootApplication
public class Application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import static com.bang_ggood.user.UserFixture.USER1;
import static com.bang_ggood.user.UserFixture.oauthInfoResponseUSER1;
import static org.mockito.ArgumentMatchers.any;

@ExtendWith(MockitoExtension.class)
class UserServiceTest extends IntegrationTestSupport {
Expand All @@ -28,15 +29,17 @@ class UserServiceTest extends IntegrationTestSupport {
@Autowired
private UserRepository userRepository;

private static final OauthLoginRequest oauthLoginRequest = new OauthLoginRequest("testCode");

@DisplayName("로그인 성공 : 존재하지 않는 회원이면 데이터베이스에 새로운 유저를 추가하고 토큰을 반환한다.")
@Test
void login_signup() {
// given
Mockito.when(oauthClient.requestOauthInfo(new OauthLoginRequest("")))
Mockito.when(oauthClient.requestOauthInfo(any(OauthLoginRequest.class)))
.thenReturn(UserFixture.oauthInfoResponseUSER2);

// when
String token = userService.login(new OauthLoginRequest(""));
String token = userService.login(oauthLoginRequest);

// then
Assertions.assertThat(token).isNotBlank();
Expand All @@ -47,11 +50,11 @@ void login_signup() {
void login() {
// given
userRepository.save(USER1);
Mockito.when(oauthClient.requestOauthInfo(new OauthLoginRequest("")))
Mockito.when(oauthClient.requestOauthInfo(any(OauthLoginRequest.class)))
.thenReturn(oauthInfoResponseUSER1);

// when
String token = userService.login(new OauthLoginRequest(""));
String token = userService.login(oauthLoginRequest);

// then
Assertions.assertThat(token).isNotBlank();
Expand Down

0 comments on commit 76426ba

Please sign in to comment.