Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 테스트 코드 리팩토링 #730

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
@SuppressWarnings("NonAsciiCharacters")
class AuthIntegrationTest extends IntegrationTest {

@BeforeEach
void setUp() {
super.setUp();
}

@Test
void 구글_로그인을_한다() throws Exception {
// TODO : 실제 구글 id로 Oauth 기능 테스트하기
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class ContentIntegrationTest extends IntegrationTest {

@BeforeEach
void setUp() {
super.setUp();

study = new Study("studyName", 2, 20);
memberDto = createMember("member1");
participant = Participant.createParticipantOfStudy(study, memberDto.member(), "nickname");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

섬세하군요👍

@DisplayNameGeneration(ReplaceUnderscores.class)
@AutoConfigureMockMvc
@Transactional
Expand All @@ -44,6 +45,7 @@ class IntegrationTest {
@Autowired
protected ObjectMapper objectMapper;

@Autowired
protected MockMvc mockMvc;

@Autowired
Expand All @@ -58,14 +60,6 @@ class IntegrationTest {
@MockBean
private OauthClients oauthClients;

void setUp() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}

protected void setMockMvc() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}

Comment on lines -62 to -69
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꼼꼼한 리팩토링 👍

public LoginResponse 구글_로그인(String name) throws Exception {
OauthLoginRequest request = new OauthLoginRequest("google", "oauthLoginCode");
String jsonRequest = objectMapper.writeValueAsString(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ class MemberIntegrationTest extends IntegrationTest {

@BeforeEach
void setUp() {
super.setUp();

study = new Study("studyName", 1, 20);

memberDto1 = createMember("member1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class ParticipantIntegrationTest extends IntegrationTest {

@BeforeEach
void setUp() {
super.setUp();
study = new Study("studyName", 3, 20);
memberDto = createMember("member1");
participant = Participant.createParticipantOfStudy(study, memberDto.member(), "nickname");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class PollingIntegrationTest extends IntegrationTest {

@BeforeEach
void setUp() {
super.setUp();
study = new Study("studyName", 3, 20);
memberDto1 = createMember("member1");
memberDto2 = createMember("member2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class StudyIntegrationTest extends IntegrationTest {

@BeforeEach
void setUp() {
super.setMockMvc();
study1 = new Study("study1", 3, 20);
study2 = new Study("study2", 4, 30);
memberDto1 = createMember("member1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class ViewIntegrationTest extends IntegrationTest {

@BeforeEach
void setUp() {
super.setUp();
memberDto = createMember("member");
setUpWithNativeQuery();
EntityManagerUtil.flushAndClearContext(entityManager);
Expand Down