From bc56f07c23e159369ae41a250a58d0e5bf6566a8 Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:04:16 +0900 Subject: [PATCH 01/12] =?UTF-8?q?refactor:=20=EC=9D=B8=EC=88=98=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EB=B3=B5=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/acceptance/AcceptanceTest.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java index f78df405..3f23bf53 100644 --- a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java +++ b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java @@ -53,7 +53,6 @@ @SpringBootTest @AutoConfigureMockMvc @Transactional -@Disabled("무중단 배포를 위한 API 버저닝으로 인한 임시 disabled") class AcceptanceTest { @MockBean @@ -131,7 +130,7 @@ void setUp() { .parseSubject(로그인_정보.tokenResponse().accessToken(), tokenConfig.secretKey())); MvcResult result = mockMvc.perform( - get("/api/studies") + get("/api/v2/studies") .param("memberId", String.valueOf(memberId)) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) .andExpect(status().isOk()) @@ -145,7 +144,7 @@ void setUp() { } private LoginResponse 비회원_로그인을_진행한다() throws Exception { - MvcResult result = mockMvc.perform(post("/api/auth/guest")) + MvcResult result = mockMvc.perform(post("/api/v2/auth/guest")) .andExpect(status().isOk()) .andReturn(); @@ -166,7 +165,7 @@ void setUp() { "mock-picture")); MvcResult result = mockMvc.perform( - post("/api/auth/login") + post("/api/v2/auth/login") .contentType(MediaType.APPLICATION_JSON) .content(jsonRequest)) .andExpect(status().isOk()) @@ -182,7 +181,7 @@ void setUp() { CreateStudyRequest request = new CreateStudyRequest("studyName", 1, 20); String jsonRequest = objectMapper.writeValueAsString(request); MvcResult result = mockMvc.perform( - post("/api/studies") + post("/api/v2/studies") .contentType(MediaType.APPLICATION_JSON) .content(jsonRequest) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) @@ -192,7 +191,7 @@ void setUp() { String[] parsed = locationHeader.split("/"); System.out.println(locationHeader); - return Long.parseLong(parsed[3]); + return Long.parseLong(parsed[4]); } private Long 스터디에_참여한다(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { @@ -202,7 +201,7 @@ void setUp() { String jsonRequest = objectMapper.writeValueAsString(request); MvcResult result = mockMvc.perform( - post("/api/studies/{studyId}/participants", 스터디_아이디) + post("/api/v2/studies/{studyId}/participants", 스터디_아이디) .contentType(MediaType.APPLICATION_JSON) .content(jsonRequest) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) @@ -220,7 +219,7 @@ void setUp() { WritePlanRequest request = new WritePlanRequest(참여자_아이디, Map.of("plan", "test")); String jsonRequest = objectMapper.writeValueAsString(request); - mockMvc.perform(post("/api/studies/{studyId}/contents/write-plan", 스터디_아이디) + mockMvc.perform(post("/api/v2/studies/{studyId}/contents/write-plan", 스터디_아이디) .contentType(MediaType.APPLICATION_JSON) .content(jsonRequest) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) @@ -229,7 +228,7 @@ void setUp() { private void 스터디_상태를_다음_단계로_넘긴다(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { - mockMvc.perform(post("/api/studies/{studyId}/next-step", 스터디_아이디) + mockMvc.perform(post("/api/v2/studies/{studyId}/next-step", 스터디_아이디) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) .andExpect(status().isNoContent()); } @@ -239,7 +238,7 @@ void setUp() { Map.of("retrospect", "test")); String jsonRequest = objectMapper.writeValueAsString(request); - mockMvc.perform(post("/api/studies/{studyId}/contents/write-retrospect", + mockMvc.perform(post("/api/v2/studies/{studyId}/contents/write-retrospect", 스터디_아이디) .contentType(MediaType.APPLICATION_JSON) .content(jsonRequest) @@ -248,7 +247,7 @@ void setUp() { } private void 스터디_종료_후_결과_조회(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { - MvcResult result = mockMvc.perform(get("/api/studies/{studyId}/participants", 스터디_아이디) + MvcResult result = mockMvc.perform(get("/api/v2/studies/{studyId}/participants", 스터디_아이디) .accept(MediaType.APPLICATION_JSON) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) .andExpect(status().isOk()) @@ -268,7 +267,7 @@ void setUp() { } private String 스터디_아이디로_참여_코드를_얻는다(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { - MvcResult result = mockMvc.perform(get("/api/participant-codes") + MvcResult result = mockMvc.perform(get("/api/v2/participant-codes") .param("studyId", 스터디_아이디.toString()) .accept(MediaType.APPLICATION_JSON) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) @@ -284,7 +283,7 @@ void setUp() { } private void 참여_코드로_스터디_아이디를_얻는다(LoginResponse 로그인_정보, String 참여_코드) throws Exception { - MvcResult result = mockMvc.perform(get("/api/studies") + MvcResult result = mockMvc.perform(get("/api/v2/studies") .param("participantCode", 참여_코드) .accept(MediaType.APPLICATION_JSON) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) From c209ebdf0f6091d5be9bca271a0ba887cab68940 Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:10:31 +0900 Subject: [PATCH 02/12] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0,=20?= =?UTF-8?q?=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/acceptance/AcceptanceTest.java | 50 ++++++++----------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java index 3f23bf53..3c79ab62 100644 --- a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java +++ b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java @@ -1,6 +1,7 @@ package harustudy.backend.acceptance; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -55,14 +56,14 @@ @Transactional class AcceptanceTest { - @MockBean - private OauthClients oauthClients; + @Autowired + private MockMvc mockMvc; @Autowired private ObjectMapper objectMapper; - @Autowired - private MockMvc mockMvc; + @MockBean + private OauthClients oauthClients; @Autowired private JwtTokenProvider jwtTokenProvider; @@ -70,14 +71,6 @@ class AcceptanceTest { @Autowired private TokenConfig tokenConfig; - @Autowired - private WebApplicationContext webApplicationContext; - - @BeforeEach - void setUp() { - this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build(); - } - @Test void 회원으로_스터디를_진행한다() throws Exception { LoginResponse 로그인_정보 = 구글_로그인을_진행한다(); @@ -94,9 +87,9 @@ void setUp() { @Test void 회원으로_진행했었던_스터디_목록을_조회한다() throws Exception { + LoginResponse 로그인_정보 = 구글_로그인을_진행한다(); 회원으로_스터디를_진행한다(); 회원으로_스터디를_진행한다(); - LoginResponse 로그인_정보 = 구글_로그인을_진행한다(); List 회원으로_완료한_스터디_목록 = 회원으로_진행했던_모든_스터디_목록을_조회한다(로그인_정보); for (StudyResponse 스터디_정보 : 회원으로_완료한_스터디_목록) { 스터디_종료_후_결과_조회(로그인_정보, 스터디_정보.studyId()); @@ -124,10 +117,9 @@ void setUp() { 참여_코드로_스터디_아이디를_얻는다(로그인_정보, 참여_코드); } - private List 회원으로_진행했던_모든_스터디_목록을_조회한다(LoginResponse 로그인_정보) - throws Exception { - long memberId = Long.parseLong(jwtTokenProvider - .parseSubject(로그인_정보.tokenResponse().accessToken(), tokenConfig.secretKey())); + private List 회원으로_진행했던_모든_스터디_목록을_조회한다(LoginResponse 로그인_정보) throws Exception { + long memberId = Long.parseLong( + jwtTokenProvider.parseSubject(로그인_정보.tokenResponse().accessToken(), tokenConfig.secretKey())); MvcResult result = mockMvc.perform( get("/api/v2/studies") @@ -137,8 +129,7 @@ void setUp() { .andReturn(); String jsonResponse = result.getResponse().getContentAsString(StandardCharsets.UTF_8); - StudiesResponse StudiesResponse = objectMapper.readValue(jsonResponse, - StudiesResponse.class); + StudiesResponse StudiesResponse = objectMapper.readValue(jsonResponse, StudiesResponse.class); return StudiesResponse.studies(); } @@ -150,6 +141,7 @@ void setUp() { String jsonResponse = result.getResponse().getContentAsString(StandardCharsets.UTF_8); TokenResponse tokenResponse = objectMapper.readValue(jsonResponse, TokenResponse.class); + return new LoginResponse(tokenResponse, null); } @@ -174,6 +166,7 @@ void setUp() { String jsonResponse = result.getResponse().getContentAsString(StandardCharsets.UTF_8); Cookie refreshToken = result.getResponse().getCookie("refreshToken"); TokenResponse tokenResponse = objectMapper.readValue(jsonResponse, TokenResponse.class); + return new LoginResponse(tokenResponse, refreshToken); } @@ -187,10 +180,10 @@ void setUp() { .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) .andExpect(status().isCreated()) .andReturn(); - String locationHeader = result.getResponse().getHeader(HttpHeaders.LOCATION); + String locationHeader = result.getResponse().getHeader(HttpHeaders.LOCATION); String[] parsed = locationHeader.split("/"); - System.out.println(locationHeader); + return Long.parseLong(parsed[4]); } @@ -226,8 +219,7 @@ void setUp() { .andExpect(status().isOk()); } - private void 스터디_상태를_다음_단계로_넘긴다(LoginResponse 로그인_정보, Long 스터디_아이디) - throws Exception { + private void 스터디_상태를_다음_단계로_넘긴다(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { mockMvc.perform(post("/api/v2/studies/{studyId}/next-step", 스터디_아이디) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) .andExpect(status().isNoContent()); @@ -238,8 +230,7 @@ void setUp() { Map.of("retrospect", "test")); String jsonRequest = objectMapper.writeValueAsString(request); - mockMvc.perform(post("/api/v2/studies/{studyId}/contents/write-retrospect", - 스터디_아이디) + mockMvc.perform(post("/api/v2/studies/{studyId}/contents/write-retrospect", 스터디_아이디) .contentType(MediaType.APPLICATION_JSON) .content(jsonRequest) .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) @@ -275,8 +266,7 @@ void setUp() { .andReturn(); String response = result.getResponse().getContentAsString(StandardCharsets.UTF_8); - ParticipantCodeResponse jsonResponse = objectMapper.readValue(response, - ParticipantCodeResponse.class); + ParticipantCodeResponse jsonResponse = objectMapper.readValue(response, ParticipantCodeResponse.class); assertThat(jsonResponse.participantCode()).hasSize(6); return jsonResponse.participantCode(); @@ -289,8 +279,10 @@ void setUp() { .header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) .andExpect(status().isOk()) .andReturn(); + String response = result.getResponse().getContentAsString(StandardCharsets.UTF_8); - Assertions.assertDoesNotThrow(() -> objectMapper.readValue(response, - StudyResponse.class)); + + assertThatCode(() -> objectMapper.readValue(response, StudyResponse.class)) + .doesNotThrowAnyException(); } } From 1fa27ea2c1034d6e0bc1ec54c97ecd451bbfa83c Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:13:59 +0900 Subject: [PATCH 03/12] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/integration/AuthIntegrationTest.java | 15 ++++++--------- .../integration/ContentIntegrationTest.java | 3 +-- .../backend/integration/IntegrationTest.java | 1 - .../integration/MemberIntegrationTest.java | 1 - .../integration/ParticipantIntegrationTest.java | 1 - .../integration/PollingIntegrationTest.java | 1 - .../backend/integration/StudyIntegrationTest.java | 1 - .../backend/integration/ViewIntegrationTest.java | 3 +-- 8 files changed, 8 insertions(+), 18 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java index 0f21e542..bf8828c5 100644 --- a/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java @@ -1,26 +1,23 @@ package harustudy.backend.integration; -import static org.assertj.core.api.SoftAssertions.assertSoftly; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.cookie; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import harustudy.backend.auth.domain.RefreshToken; import harustudy.backend.auth.dto.TokenResponse; import harustudy.backend.member.domain.Member; import jakarta.servlet.http.Cookie; -import java.nio.charset.StandardCharsets; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.web.servlet.MvcResult; +import java.nio.charset.StandardCharsets; + +import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.cookie; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SuppressWarnings("NonAsciiCharacters") -@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) class AuthIntegrationTest extends IntegrationTest { @BeforeEach diff --git a/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java index 0e3ef335..7595245a 100644 --- a/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java @@ -27,8 +27,7 @@ import org.springframework.test.web.servlet.MvcResult; @SuppressWarnings("NonAsciiCharacters") -@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) -public class ContentIntegrationTest extends IntegrationTest { +class ContentIntegrationTest extends IntegrationTest { private Study study; private MemberDto memberDto; diff --git a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java index 7b0fefa3..43c22274 100644 --- a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java @@ -32,7 +32,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.WebApplicationContext; -@SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) @AutoConfigureMockMvc @Transactional diff --git a/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java index 5830c739..159ec41e 100644 --- a/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java @@ -18,7 +18,6 @@ import org.springframework.test.web.servlet.MvcResult; @SuppressWarnings("NonAsciiCharacters") -@DisplayNameGeneration(ReplaceUnderscores.class) class MemberIntegrationTest extends IntegrationTest { private Study study; diff --git a/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java index 68f6d1c0..d4177391 100644 --- a/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java @@ -17,7 +17,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SuppressWarnings("NonAsciiCharacters") -@DisplayNameGeneration(ReplaceUnderscores.class) class ParticipantIntegrationTest extends IntegrationTest { private Study study; diff --git a/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java index 20667e9e..4c03ad50 100644 --- a/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java @@ -29,7 +29,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @SuppressWarnings("NonAsciiCharacters") -@DisplayNameGeneration(ReplaceUnderscores.class) class PollingIntegrationTest extends IntegrationTest { private Study study; diff --git a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java index dcf7751f..890c4006 100644 --- a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java @@ -33,7 +33,6 @@ import org.springframework.test.web.servlet.MvcResult; @SuppressWarnings("NonAsciiCharacters") -@DisplayNameGeneration(ReplaceUnderscores.class) class StudyIntegrationTest extends IntegrationTest { @Autowired diff --git a/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java index 506a0df6..55f9c31f 100644 --- a/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java @@ -24,8 +24,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @SuppressWarnings("NonAsciiCharacters") -@DisplayNameGeneration(ReplaceUnderscores.class) -public class ViewIntegrationTest extends IntegrationTest { +class ViewIntegrationTest extends IntegrationTest { private MemberDto memberDto; From 3a2aca56aa785523bb7d54b5a0527ce6b96eec67 Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:16:39 +0900 Subject: [PATCH 04/12] =?UTF-8?q?refactor:=20`@AutoConfigureMockMvc`?= =?UTF-8?q?=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98=EA=B3=A0=20=EC=9E=88?= =?UTF-8?q?=EC=9C=BC=EB=AF=80=EB=A1=9C=20`setUp`=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/integration/AuthIntegrationTest.java | 5 ----- .../backend/integration/ContentIntegrationTest.java | 2 -- .../harustudy/backend/integration/IntegrationTest.java | 10 ++-------- .../backend/integration/MemberIntegrationTest.java | 2 -- .../integration/ParticipantIntegrationTest.java | 1 - .../backend/integration/PollingIntegrationTest.java | 1 - .../backend/integration/StudyIntegrationTest.java | 1 - .../backend/integration/ViewIntegrationTest.java | 1 - 8 files changed, 2 insertions(+), 21 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java index bf8828c5..7c170c79 100644 --- a/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java @@ -20,11 +20,6 @@ @SuppressWarnings("NonAsciiCharacters") class AuthIntegrationTest extends IntegrationTest { - @BeforeEach - void setUp() { - super.setUp(); - } - @Test void 구글_로그인을_한다() throws Exception { // TODO : 실제 구글 id로 Oauth 기능 테스트하기 diff --git a/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java index 7595245a..5902826f 100644 --- a/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java @@ -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"); diff --git a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java index 43c22274..c08e5d26 100644 --- a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java @@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.context.WebApplicationContext; + @DisplayNameGeneration(ReplaceUnderscores.class) @AutoConfigureMockMvc @Transactional @@ -44,6 +45,7 @@ class IntegrationTest { @Autowired protected ObjectMapper objectMapper; + @Autowired protected MockMvc mockMvc; @Autowired @@ -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(); - } - public LoginResponse 구글_로그인(String name) throws Exception { OauthLoginRequest request = new OauthLoginRequest("google", "oauthLoginCode"); String jsonRequest = objectMapper.writeValueAsString(request); diff --git a/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java index 159ec41e..c2998b65 100644 --- a/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java @@ -26,8 +26,6 @@ class MemberIntegrationTest extends IntegrationTest { @BeforeEach void setUp() { - super.setUp(); - study = new Study("studyName", 1, 20); memberDto1 = createMember("member1"); diff --git a/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java index d4177391..e030cbfa 100644 --- a/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java @@ -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"); diff --git a/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java index 4c03ad50..811178d0 100644 --- a/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java @@ -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"); diff --git a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java index 890c4006..3348a98c 100644 --- a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java @@ -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"); diff --git a/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java index 55f9c31f..0ad2b345 100644 --- a/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java @@ -30,7 +30,6 @@ class ViewIntegrationTest extends IntegrationTest { @BeforeEach void setUp() { - super.setUp(); memberDto = createMember("member"); setUpWithNativeQuery(); EntityManagerUtil.flushAndClearContext(entityManager); From 9c296bcbfa13cc66091e8308a5462ec79341eef5 Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:20:12 +0900 Subject: [PATCH 05/12] =?UTF-8?q?chore:=20`GenerationStrategy`=EB=A5=BC=20?= =?UTF-8?q?`IntegrationTest`=EB=A1=9C=20=EC=9D=B4=EB=8F=99,=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../harustudy/backend/integration/IntegrationTest.java | 7 ++++--- .../backend/integration/StudyIntegrationTest.java | 9 --------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java index c08e5d26..1b4fa2ed 100644 --- a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java @@ -14,6 +14,7 @@ import harustudy.backend.auth.util.JwtTokenProvider; import harustudy.backend.member.domain.LoginType; import harustudy.backend.member.domain.Member; +import harustudy.backend.participantcode.domain.GenerationStrategy; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import jakarta.servlet.http.Cookie; @@ -48,15 +49,15 @@ class IntegrationTest { @Autowired protected MockMvc mockMvc; - @Autowired - private WebApplicationContext webApplicationContext; - @Autowired private JwtTokenProvider jwtTokenProvider; @Autowired private TokenConfig tokenConfig; + @Autowired + protected GenerationStrategy generationStrategy; + @MockBean private OauthClients oauthClients; diff --git a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java index 3348a98c..b7a6e181 100644 --- a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java @@ -35,15 +35,6 @@ @SuppressWarnings("NonAsciiCharacters") class StudyIntegrationTest extends IntegrationTest { - @Autowired - private ObjectMapper objectMapper; - - @Autowired - private EntityManager entityManager; - - @Autowired - private GenerationStrategy generationStrategy; - private Study study1; private Study study2; private MemberDto memberDto1; From 4b08854c5da351988ffbba56d43239c769bf2c62 Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:23:21 +0900 Subject: [PATCH 06/12] =?UTF-8?q?refactor:=20=EC=9D=B8=EC=A6=9D=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=A9=94=EC=86=8C=EB=93=9C=EB=A5=BC=20?= =?UTF-8?q?=EC=83=81=EC=9C=84=20=ED=81=B4=EB=9E=98=EC=8A=A4=EC=97=90=20?= =?UTF-8?q?=EB=91=90=EC=A7=80=20=EC=95=8A=EA=B3=A0=20`AuthIntegrationTest`?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../integration/AuthIntegrationTest.java | 27 +++++++++++++ .../backend/integration/IntegrationTest.java | 38 ++++--------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java index 7c170c79..97190a33 100644 --- a/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/AuthIntegrationTest.java @@ -1,6 +1,8 @@ package harustudy.backend.integration; import harustudy.backend.auth.domain.RefreshToken; +import harustudy.backend.auth.dto.OauthLoginRequest; +import harustudy.backend.auth.dto.OauthTokenResponse; import harustudy.backend.auth.dto.TokenResponse; import harustudy.backend.member.domain.Member; import jakarta.servlet.http.Cookie; @@ -11,8 +13,11 @@ import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.test.web.servlet.MvcResult; import java.nio.charset.StandardCharsets; +import java.util.Map; import static org.assertj.core.api.SoftAssertions.assertSoftly; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.BDDMockito.given; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.cookie; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -99,4 +104,26 @@ class AuthIntegrationTest extends IntegrationTest { .andExpect(cookie().maxAge("refreshToken", 0)) .andReturn(); } + + private LoginResponse 구글_로그인(String name) throws Exception { + OauthLoginRequest request = new OauthLoginRequest("google", "oauthLoginCode"); + String jsonRequest = objectMapper.writeValueAsString(request); + + given(oauthClients.requestOauthToken(any(String.class), any(String.class))) + .willReturn(new OauthTokenResponse("mock-token-type", "mock-access-token", + "mock-scope")); + given(oauthClients.requestOauthUserInfo(any(String.class), any(String.class))) + .willReturn(Map.of("name", name, "email", "mock-email", "picture", "mock-picture")); + + MvcResult result = mockMvc.perform( + post("/api/v2/auth/login") + .contentType(MediaType.APPLICATION_JSON) + .content(jsonRequest)) + .andReturn(); + + String jsonResponse = result.getResponse().getContentAsString(StandardCharsets.UTF_8); + Cookie refreshToken = result.getResponse().getCookie("refreshToken"); + TokenResponse tokenResponse = objectMapper.readValue(jsonResponse, TokenResponse.class); + return new LoginResponse(tokenResponse, refreshToken); + } } diff --git a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java index 1b4fa2ed..7f63f4b8 100644 --- a/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/IntegrationTest.java @@ -59,28 +59,15 @@ class IntegrationTest { protected GenerationStrategy generationStrategy; @MockBean - private OauthClients oauthClients; + protected OauthClients oauthClients; - public LoginResponse 구글_로그인(String name) throws Exception { - OauthLoginRequest request = new OauthLoginRequest("google", "oauthLoginCode"); - String jsonRequest = objectMapper.writeValueAsString(request); - - given(oauthClients.requestOauthToken(any(String.class), any(String.class))) - .willReturn(new OauthTokenResponse("mock-token-type", "mock-access-token", - "mock-scope")); - given(oauthClients.requestOauthUserInfo(any(String.class), any(String.class))) - .willReturn(Map.of("name", name, "email", "mock-email", "picture", "mock-picture")); - - MvcResult result = mockMvc.perform( - post("/api/v2/auth/login") - .contentType(MediaType.APPLICATION_JSON) - .content(jsonRequest)) - .andReturn(); - - String jsonResponse = result.getResponse().getContentAsString(StandardCharsets.UTF_8); - Cookie refreshToken = result.getResponse().getCookie("refreshToken"); - TokenResponse tokenResponse = objectMapper.readValue(jsonResponse, TokenResponse.class); - return new LoginResponse(tokenResponse, refreshToken); + protected MemberDto createMember(String name) { + Member member = generateAndSaveMemberNamedWith(name); + String accessToken = jwtTokenProvider.createAccessToken(String.valueOf(member.getId()), + tokenConfig.accessTokenExpireLength(), tokenConfig.secretKey()); + RefreshToken refreshToken = generateAndSaveRefreshTokenOf(member); + Cookie cookie = new Cookie("refreshToken", refreshToken.getUuid().toString()); + return new MemberDto(member, accessToken, cookie); } protected Member generateAndSaveMemberNamedWith(String name) { @@ -95,13 +82,4 @@ protected RefreshToken generateAndSaveRefreshTokenOf(Member member) { entityManager.persist(refreshToken); return refreshToken; } - - protected MemberDto createMember(String name) { - Member member = generateAndSaveMemberNamedWith(name); - String accessToken = jwtTokenProvider.createAccessToken(String.valueOf(member.getId()), - tokenConfig.accessTokenExpireLength(), tokenConfig.secretKey()); - RefreshToken refreshToken = generateAndSaveRefreshTokenOf(member); - Cookie cookie = new Cookie("refreshToken", refreshToken.getUuid().toString()); - return new MemberDto(member, accessToken, cookie); - } } From 431ad8381c99abbb37c9235cc2999ea6e476304c Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:24:54 +0900 Subject: [PATCH 07/12] =?UTF-8?q?chore:=20`@Disabled`=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=EB=90=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EB=B3=B5=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../harustudy/backend/integration/StudyIntegrationTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java index b7a6e181..1a3e0909 100644 --- a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java @@ -197,7 +197,6 @@ void setUp() { }); } - @Disabled("무중단 배포를 위한 API 버저닝으로 인한 임시 disabled") @Test void 스터디를_개설한다() throws Exception { // given @@ -217,7 +216,7 @@ void setUp() { String location = result.getResponse().getHeader("Location"); SoftAssertions.assertSoftly(softly -> { Assertions.assertThat(location).isNotNull(); - Assertions.assertThat(location.split("/")).hasSize(4); + Assertions.assertThat(location.split("/")).hasSize(5); }); } From 81f6419cdb079d9660d23bc4d4df9c13bbfd4d65 Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Mon, 13 Nov 2023 23:28:40 +0900 Subject: [PATCH 08/12] =?UTF-8?q?chore:=20=EB=A9=94=EC=86=8C=EB=93=9C?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD,=20=EB=AA=A8=EB=93=A0=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=EA=B0=80=20`TestEntityManager`?= =?UTF-8?q?=EA=B0=80=20=EC=95=84=EB=8B=8C=20`EntityManager`=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/ContentRepositoryTest.java | 22 +++++++++---------- .../content/service/ContentServiceTest.java | 16 +++++++------- .../integration/ContentIntegrationTest.java | 14 +++++------- .../integration/MemberIntegrationTest.java | 6 ++--- .../ParticipantIntegrationTest.java | 6 ++--- .../integration/PollingIntegrationTest.java | 6 ++--- .../integration/StudyIntegrationTest.java | 11 ++-------- .../integration/ViewIntegrationTest.java | 6 ++--- .../member/service/MemberServiceTest.java | 4 ++-- .../service/ParticipantServiceTest.java | 14 ++++++------ .../service/ParticipantCodeServiceTest.java | 4 ++-- .../polling/service/PollingServiceTest.java | 12 +++++----- .../backend/testutils/EntityManagerUtil.java | 17 -------------- .../backend/testutils/EntityManagerUtils.java | 11 ++++++++++ .../backend/view/service/ViewServiceTest.java | 4 ++-- 15 files changed, 65 insertions(+), 88 deletions(-) delete mode 100644 backend/src/test/java/harustudy/backend/testutils/EntityManagerUtil.java create mode 100644 backend/src/test/java/harustudy/backend/testutils/EntityManagerUtils.java diff --git a/backend/src/test/java/harustudy/backend/content/repository/ContentRepositoryTest.java b/backend/src/test/java/harustudy/backend/content/repository/ContentRepositoryTest.java index 34006416..5f804ba4 100644 --- a/backend/src/test/java/harustudy/backend/content/repository/ContentRepositoryTest.java +++ b/backend/src/test/java/harustudy/backend/content/repository/ContentRepositoryTest.java @@ -10,14 +10,14 @@ import java.util.Map; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; +import jakarta.persistence.EntityManager; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) @@ -25,7 +25,7 @@ class ContentRepositoryTest { @Autowired - private TestEntityManager testEntityManager; + private EntityManager entityManager; @Autowired private ContentRepository contentRepository; @@ -38,11 +38,11 @@ void setUp() { Member member = new Member("member", "email", "imageUrl", LoginType.GUEST); participant = Participant.createParticipantOfStudy(study, member, "nickname"); - testEntityManager.persist(study); - testEntityManager.persist(member); - testEntityManager.persist(participant); + entityManager.persist(study); + entityManager.persist(member); + entityManager.persist(participant); - EntityManagerUtil.flushAndClearContext(testEntityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test @@ -52,9 +52,9 @@ void setUp() { "80%"); Content content = new Content(participant, 1); content.changePlan(plan); - testEntityManager.persist(content); + entityManager.persist(content); - EntityManagerUtil.flushAndClearContext(testEntityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when Content found = contentRepository.findById(content.getId()) @@ -75,9 +75,9 @@ void setUp() { Content content = new Content(participant, 1); content.changePlan(plan); content.changeRetrospect(retrospect); - testEntityManager.persist(content); + entityManager.persist(content); - EntityManagerUtil.flushAndClearContext(testEntityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when Content found = contentRepository.findById(content.getId()) diff --git a/backend/src/test/java/harustudy/backend/content/service/ContentServiceTest.java b/backend/src/test/java/harustudy/backend/content/service/ContentServiceTest.java index 57ab8044..a57f76e0 100644 --- a/backend/src/test/java/harustudy/backend/content/service/ContentServiceTest.java +++ b/backend/src/test/java/harustudy/backend/content/service/ContentServiceTest.java @@ -18,7 +18,7 @@ import harustudy.backend.participant.exception.StudyStepException; import harustudy.backend.study.domain.Study; import harustudy.backend.study.exception.StudyNotFoundException; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import java.util.List; @@ -61,7 +61,7 @@ void setUp() { entityManager.persist(participant); entityManager.persist(content); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test @@ -73,7 +73,7 @@ void setUp() { study.proceed(); entityManager.merge(study); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); WritePlanRequest request = new WritePlanRequest(participant.getId(), Map.of("plan", "abc")); @@ -90,7 +90,7 @@ void setUp() { study.proceed(); entityManager.merge(study); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); AuthMember authMember = new AuthMember(member.getId()); WritePlanRequest request = new WritePlanRequest(participant.getId(), @@ -110,7 +110,7 @@ void setUp() { study.proceed(); entityManager.merge(study); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); AuthMember authMember = new AuthMember(member.getId()); WriteRetrospectRequest request = new WriteRetrospectRequest(participant.getId(), @@ -148,7 +148,7 @@ void setUp() { entityManager.merge(content); entityManager.merge(study); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); WriteRetrospectRequest request = new WriteRetrospectRequest(participant.getId(), Map.of("retrospect", "abc")); @@ -169,7 +169,7 @@ void setUp() { content.changeRetrospect(retrospect); entityManager.merge(content); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when ContentsResponse contentsResponse = @@ -207,7 +207,7 @@ void setUp() { entityManager.merge(study); entityManager.merge(content); entityManager.persist(anotherContent); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when ContentsResponse contentsResponse = contentService.findContentsWithFilter(authMember, diff --git a/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java index 5902826f..f2e89f0f 100644 --- a/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ContentIntegrationTest.java @@ -17,10 +17,8 @@ import java.util.List; import java.util.Map; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -46,7 +44,7 @@ void setUp() { entityManager.persist(participant); entityManager.persist(content); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test @@ -58,7 +56,7 @@ void setUp() { study.proceed(); entityManager.merge(study); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when, then mockMvc.perform( @@ -79,7 +77,7 @@ void setUp() { entityManager.merge(study); entityManager.merge(content); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); WriteRetrospectRequest request = new WriteRetrospectRequest(participant.getId(), Map.of("retrospect", "test")); @@ -107,7 +105,7 @@ void setUp() { entityManager.merge(study); entityManager.merge(content); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when MvcResult result = mockMvc.perform( @@ -147,7 +145,7 @@ void setUp() { entityManager.merge(content); entityManager.merge(participant); entityManager.persist(anotherContent); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when MvcResult result = mockMvc.perform( diff --git a/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java index c2998b65..ed0ae579 100644 --- a/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/MemberIntegrationTest.java @@ -9,10 +9,8 @@ import harustudy.backend.study.domain.Study; import java.nio.charset.StandardCharsets; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.test.web.servlet.MvcResult; @@ -39,7 +37,7 @@ void setUp() { entityManager.persist(study); entityManager.persist(participant1); entityManager.persist(participant2); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test diff --git a/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java index e030cbfa..6c55ebba 100644 --- a/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ParticipantIntegrationTest.java @@ -3,10 +3,8 @@ import harustudy.backend.participant.domain.Participant; import harustudy.backend.participant.dto.ParticipantResponse; import harustudy.backend.study.domain.Study; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -31,7 +29,7 @@ void setUp() { entityManager.persist(study); entityManager.persist(participant); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test diff --git a/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java index 811178d0..7ab05735 100644 --- a/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/PollingIntegrationTest.java @@ -6,10 +6,8 @@ import harustudy.backend.polling.dto.ProgressResponse; import harustudy.backend.study.domain.Study; import harustudy.backend.polling.dto.WaitingResponse; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -53,7 +51,7 @@ void setUp() { entityManager.persist(participant1); entityManager.persist(participant2); entityManager.persist(participant3); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test diff --git a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java index 1a3e0909..5336f771 100644 --- a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java @@ -7,27 +7,20 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import com.fasterxml.jackson.databind.ObjectMapper; import harustudy.backend.participant.domain.Participant; import harustudy.backend.participant.domain.Step; -import harustudy.backend.participantcode.domain.GenerationStrategy; import harustudy.backend.participantcode.domain.ParticipantCode; import harustudy.backend.study.domain.Study; import harustudy.backend.study.dto.CreateStudyRequest; import harustudy.backend.study.dto.StudiesResponse; import harustudy.backend.study.dto.StudyResponse; -import harustudy.backend.testutils.EntityManagerUtil; -import jakarta.persistence.EntityManager; +import harustudy.backend.testutils.EntityManagerUtils; import java.nio.charset.StandardCharsets; import java.util.List; import org.assertj.core.api.Assertions; import org.assertj.core.api.SoftAssertions; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; @@ -51,7 +44,7 @@ void setUp() { entityManager.persist(study2); entityManager.persist(participant1); entityManager.persist(participantCode); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test diff --git a/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java index 0ad2b345..100ba76d 100644 --- a/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/ViewIntegrationTest.java @@ -2,7 +2,7 @@ import harustudy.backend.participant.domain.Participant; import harustudy.backend.study.domain.Study; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import harustudy.backend.view.dto.StudyRecordsPageResponse; import java.nio.charset.StandardCharsets; import java.time.LocalDate; @@ -10,8 +10,6 @@ import java.util.Map; import java.util.Map.Entry; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.DisplayNameGeneration; -import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -32,7 +30,7 @@ class ViewIntegrationTest extends IntegrationTest { void setUp() { memberDto = createMember("member"); setUpWithNativeQuery(); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } private void setUpWithNativeQuery() { diff --git a/backend/src/test/java/harustudy/backend/member/service/MemberServiceTest.java b/backend/src/test/java/harustudy/backend/member/service/MemberServiceTest.java index 2c806b35..3456de7c 100644 --- a/backend/src/test/java/harustudy/backend/member/service/MemberServiceTest.java +++ b/backend/src/test/java/harustudy/backend/member/service/MemberServiceTest.java @@ -7,7 +7,7 @@ import harustudy.backend.member.domain.LoginType; import harustudy.backend.member.domain.Member; import harustudy.backend.member.dto.MemberResponse; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import org.junit.jupiter.api.BeforeEach; @@ -42,7 +42,7 @@ void setUp() { entityManager.persist(member1); entityManager.persist(member2); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test diff --git a/backend/src/test/java/harustudy/backend/participant/service/ParticipantServiceTest.java b/backend/src/test/java/harustudy/backend/participant/service/ParticipantServiceTest.java index 47cda0c0..005bc11c 100644 --- a/backend/src/test/java/harustudy/backend/participant/service/ParticipantServiceTest.java +++ b/backend/src/test/java/harustudy/backend/participant/service/ParticipantServiceTest.java @@ -12,7 +12,7 @@ import harustudy.backend.participantcode.domain.ParticipantCode; import harustudy.backend.study.domain.Study; import harustudy.backend.study.exception.StudyAlreadyStartedException; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import jakarta.persistence.EntityManager; import jakarta.persistence.PersistenceContext; import org.assertj.core.api.AssertionsForClassTypes; @@ -65,7 +65,7 @@ void setUp() { entityManager.persist(participantCode2); entityManager.persist(member1); entityManager.persist(member2); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test @@ -75,7 +75,7 @@ void setUp() { ParticipateStudyRequest request = new ParticipateStudyRequest(member1.getId(), "nick"); Study study = entityManager.merge(study1); study.proceed(); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when, then assertThatThrownBy( @@ -92,7 +92,7 @@ void setUp() { entityManager.persist(participant); entityManager.persist(anotherParticipant); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); List responses = Stream.of(participant, anotherParticipant) .map(ParticipantResponse::from) @@ -129,7 +129,7 @@ void setUp() { entityManager.persist(participant); entityManager.persist(anotherParticipant); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); ParticipantsResponse expected = ParticipantsResponse.from(List.of( ParticipantResponse.from(participant) @@ -151,7 +151,7 @@ void setUp() { AuthMember authMember = new AuthMember(member2.getId()); entityManager.persist(participant); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when, then assertThatThrownBy(() -> @@ -168,7 +168,7 @@ void setUp() { entityManager.persist(participant1); entityManager.persist(participant2); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when, then assertThatThrownBy(() -> diff --git a/backend/src/test/java/harustudy/backend/participantcode/service/ParticipantCodeServiceTest.java b/backend/src/test/java/harustudy/backend/participantcode/service/ParticipantCodeServiceTest.java index 15069b08..b4454688 100644 --- a/backend/src/test/java/harustudy/backend/participantcode/service/ParticipantCodeServiceTest.java +++ b/backend/src/test/java/harustudy/backend/participantcode/service/ParticipantCodeServiceTest.java @@ -4,7 +4,7 @@ import harustudy.backend.participantcode.domain.ParticipantCode; import harustudy.backend.participantcode.dto.ParticipantCodeResponse; import harustudy.backend.study.domain.Study; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import jakarta.persistence.EntityManager; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.DisplayNameGeneration; @@ -34,7 +34,7 @@ class ParticipantCodeServiceTest { ParticipantCode participantCode = new ParticipantCode(study, new CodeGenerationStrategy()); entityManager.persist(study); entityManager.persist(participantCode); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when ParticipantCodeResponse result = participantCodeService.findParticipantCodeByStudyId( diff --git a/backend/src/test/java/harustudy/backend/polling/service/PollingServiceTest.java b/backend/src/test/java/harustudy/backend/polling/service/PollingServiceTest.java index f9efde06..db5ca1b9 100644 --- a/backend/src/test/java/harustudy/backend/polling/service/PollingServiceTest.java +++ b/backend/src/test/java/harustudy/backend/polling/service/PollingServiceTest.java @@ -10,7 +10,7 @@ import harustudy.backend.polling.dto.SubmittersResponse; import harustudy.backend.polling.dto.WaitingResponse; import harustudy.backend.polling.exception.CannotSeeSubmittersException; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import jakarta.persistence.EntityManager; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGeneration; @@ -77,7 +77,7 @@ void setUp() { entityManager.persist(content1); entityManager.persist(content2); entityManager.persist(content3); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } @Test @@ -95,7 +95,7 @@ void setUp() { entityManager.merge(study); entityManager.merge(content1); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); SubmittersResponse expected = new SubmittersResponse(List.of( new SubmitterResponse("parti1", true), @@ -122,7 +122,7 @@ void setUp() { entityManager.merge(study); entityManager.merge(content1); entityManager.merge(content2); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when SubmittersResponse submitters = pollingService.findSubmitters(study.getId()); @@ -147,7 +147,7 @@ void setUp() { study.proceed(); entityManager.merge(study); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when, then assertThatThrownBy(() -> pollingService.findSubmitters(study.getId())) @@ -178,7 +178,7 @@ void setUp() { Content content = entityManager.merge(content1); entityManager.remove(participant); entityManager.remove(content); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); // when WaitingResponse response = pollingService.pollWaiting(study.getId()); diff --git a/backend/src/test/java/harustudy/backend/testutils/EntityManagerUtil.java b/backend/src/test/java/harustudy/backend/testutils/EntityManagerUtil.java deleted file mode 100644 index b974517b..00000000 --- a/backend/src/test/java/harustudy/backend/testutils/EntityManagerUtil.java +++ /dev/null @@ -1,17 +0,0 @@ -package harustudy.backend.testutils; - -import jakarta.persistence.EntityManager; -import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; - -public class EntityManagerUtil { - - public static void flushAndClearContext(EntityManager entityManager) { - entityManager.flush(); - entityManager.clear(); - } - - public static void flushAndClearContext(TestEntityManager entityManager) { - entityManager.flush(); - entityManager.clear(); - } -} diff --git a/backend/src/test/java/harustudy/backend/testutils/EntityManagerUtils.java b/backend/src/test/java/harustudy/backend/testutils/EntityManagerUtils.java new file mode 100644 index 00000000..583b5454 --- /dev/null +++ b/backend/src/test/java/harustudy/backend/testutils/EntityManagerUtils.java @@ -0,0 +1,11 @@ +package harustudy.backend.testutils; + +import jakarta.persistence.EntityManager; + +public class EntityManagerUtils { + + public static void flushAndClearContext(EntityManager entityManager) { + entityManager.flush(); + entityManager.clear(); + } +} diff --git a/backend/src/test/java/harustudy/backend/view/service/ViewServiceTest.java b/backend/src/test/java/harustudy/backend/view/service/ViewServiceTest.java index 687babab..ded8786c 100644 --- a/backend/src/test/java/harustudy/backend/view/service/ViewServiceTest.java +++ b/backend/src/test/java/harustudy/backend/view/service/ViewServiceTest.java @@ -10,7 +10,7 @@ import harustudy.backend.participant.domain.Participant; import harustudy.backend.study.domain.Study; import harustudy.backend.study.repository.StudyRepository; -import harustudy.backend.testutils.EntityManagerUtil; +import harustudy.backend.testutils.EntityManagerUtils; import harustudy.backend.view.dto.CalendarStudyRecordsResponse; import harustudy.backend.view.dto.StudyRecordsPageResponse; import jakarta.persistence.EntityManager; @@ -50,7 +50,7 @@ void setUp() { member = new Member("hiiro", "email", "imageUrl", LoginType.GUEST); entityManager.persist(member); setUpWithNativeQuery(); - EntityManagerUtil.flushAndClearContext(entityManager); + EntityManagerUtils.flushAndClearContext(entityManager); } private void setUpWithNativeQuery() { From 13bb5a651681639ec2f9ba9ee906187e64ea3bec Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Tue, 21 Nov 2023 16:58:28 +0900 Subject: [PATCH 09/12] =?UTF-8?q?chore:=20unused=20import=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/harustudy/backend/acceptance/AcceptanceTest.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java index 3c79ab62..89895d5e 100644 --- a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java +++ b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java @@ -28,9 +28,6 @@ import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; import org.junit.jupiter.api.Test; @@ -44,9 +41,7 @@ import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.context.WebApplicationContext; @SuppressWarnings("NonAsciiCharacters") @DisplayNameGeneration(ReplaceUnderscores.class) From bc6e3bf9bfb32ecf21c4fc0edd8bcd89b81a9ebd Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Tue, 21 Nov 2023 16:59:37 +0900 Subject: [PATCH 10/12] =?UTF-8?q?chore:=20softly=20=EC=84=A0=EC=96=B8?= =?UTF-8?q?=EC=9D=B4=20=EB=90=98=EA=B3=A0=20=EC=9E=88=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8D=98=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../harustudy/backend/integration/StudyIntegrationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java index 5336f771..ddc7c7c5 100644 --- a/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java +++ b/backend/src/test/java/harustudy/backend/integration/StudyIntegrationTest.java @@ -208,8 +208,8 @@ void setUp() { // then String location = result.getResponse().getHeader("Location"); SoftAssertions.assertSoftly(softly -> { - Assertions.assertThat(location).isNotNull(); - Assertions.assertThat(location.split("/")).hasSize(5); + softly.assertThat(location).isNotNull(); + softly.assertThat(location.split("/")).hasSize(5); }); } From 2a90fdfeeb6a4883f00a7722eadc05296f5229df Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Tue, 21 Nov 2023 17:00:33 +0900 Subject: [PATCH 11/12] =?UTF-8?q?chore:=20=EB=A7=A4=EC=A7=81=20=EB=84=98?= =?UTF-8?q?=EB=B2=84=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/harustudy/backend/acceptance/AcceptanceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java index 89895d5e..bdde5284 100644 --- a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java +++ b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java @@ -179,7 +179,7 @@ class AcceptanceTest { String locationHeader = result.getResponse().getHeader(HttpHeaders.LOCATION); String[] parsed = locationHeader.split("/"); - return Long.parseLong(parsed[4]); + return Long.parseLong(parsed[parsed.length - 1]); } private Long 스터디에_참여한다(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { From 5d0cb9ad28169a9fce47cb841eaf6d3cfa1420da Mon Sep 17 00:00:00 2001 From: woosung1223 Date: Tue, 21 Nov 2023 17:08:18 +0900 Subject: [PATCH 12/12] =?UTF-8?q?chore:=20=EC=9D=B8=EC=88=98=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20=EB=B3=B5=EA=B5=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/harustudy/backend/acceptance/AcceptanceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java index bdde5284..f9d3d117 100644 --- a/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java +++ b/backend/src/test/java/harustudy/backend/acceptance/AcceptanceTest.java @@ -82,9 +82,9 @@ class AcceptanceTest { @Test void 회원으로_진행했었던_스터디_목록을_조회한다() throws Exception { - LoginResponse 로그인_정보 = 구글_로그인을_진행한다(); 회원으로_스터디를_진행한다(); 회원으로_스터디를_진행한다(); + LoginResponse 로그인_정보 = 구글_로그인을_진행한다(); List 회원으로_완료한_스터디_목록 = 회원으로_진행했던_모든_스터디_목록을_조회한다(로그인_정보); for (StudyResponse 스터디_정보 : 회원으로_완료한_스터디_목록) { 스터디_종료_후_결과_조회(로그인_정보, 스터디_정보.studyId());