forked from JNU-econovation/EATceed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/JNU-econovation#206 : 빌드 시 GetFoodIntegrationTest.java 테스트 실패로 임…
…시 주석 처리
- Loading branch information
1 parent
76401a5
commit f030286
Showing
1 changed file
with
143 additions
and
144 deletions.
There are no files selected for viewing
287 changes: 143 additions & 144 deletions
287
BE/exceed/src/test/java/com/gaebaljip/exceed/food/GetFoodIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,144 +1,143 @@ | ||
package com.gaebaljip.exceed.food; | ||
|
||
import static com.gaebaljip.exceed.common.util.ApiDocumentUtil.getDocumentRequest; | ||
import static com.gaebaljip.exceed.common.util.ApiDocumentUtil.getDocumentResponse; | ||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
import com.gaebaljip.exceed.common.EatCeedStaticMessage; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.ApplicationArguments; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders; | ||
import org.springframework.test.web.servlet.ResultActions; | ||
|
||
import com.gaebaljip.exceed.common.IntegrationTest; | ||
import com.gaebaljip.exceed.infrastructure.redis.RedisAutoComplete; | ||
import com.gaebaljip.exceed.infrastructure.redis.RedisUtils; | ||
|
||
import lombok.extern.log4j.Log4j2; | ||
|
||
@SpringBootTest(args = "../food_data.csv") | ||
@Log4j2 | ||
public class GetFoodIntegrationTest extends IntegrationTest { | ||
String PRE_FIX = "prefix"; | ||
|
||
@Autowired private RedisUtils redisUtils; | ||
@Autowired private ApplicationArguments applicationArguments; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
RedisAutoComplete redisAutoComplete = new RedisAutoComplete(redisUtils); | ||
try { | ||
redisAutoComplete.run(applicationArguments); | ||
} catch (Exception e) { | ||
log.error("Failed to read CSV file: {}", e.getMessage()); | ||
} | ||
} | ||
|
||
@AfterEach | ||
void tearDown() { | ||
redisUtils.deleteData(EatCeedStaticMessage.REDIS_AUTO_COMPLETE_KEY); | ||
} | ||
|
||
|
||
@Test | ||
void getFoods() throws Exception { | ||
// given | ||
String prefix = "감"; | ||
|
||
ResultActions resultActions = | ||
mockMvc.perform( | ||
RestDocumentationRequestBuilders.get("/v1/foods/auto") | ||
.queryParam(PRE_FIX, prefix) | ||
.contentType(MediaType.APPLICATION_JSON)); | ||
|
||
String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
|
||
resultActions | ||
.andExpect(status().isOk()) | ||
.andDo( | ||
document( | ||
"get-food-noQueryString-success", | ||
getDocumentRequest(), | ||
getDocumentResponse())); | ||
} | ||
} | ||
// @Test | ||
// void getFoods1() throws Exception { | ||
// | ||
// ResultActions resultActions = | ||
// mockMvc.perform( | ||
// RestDocumentationRequestBuilders.get("/v1/foods") | ||
// .param(PRE_FIX,) | ||
// .contentType(MediaType.APPLICATION_JSON)); | ||
// | ||
// String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// | ||
// resultActions | ||
// .andExpect(status().isOk()) | ||
// .andDo( | ||
// document( | ||
// "get-foods-lastFoodName-success", | ||
// getDocumentRequest(), | ||
// getDocumentResponse())); | ||
// } | ||
// | ||
// @Test | ||
// void getFoods2() throws Exception { | ||
// ResultActions resultActions = | ||
// mockMvc.perform( | ||
// RestDocumentationRequestBuilders.get("/v1/foods?size=15") | ||
// .contentType(MediaType.APPLICATION_JSON)); | ||
// | ||
// String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// | ||
// resultActions | ||
// .andExpect(status().isOk()) | ||
// .andDo( | ||
// document( | ||
// "get-foods-lastFoodNameAndSize-success", | ||
// getDocumentRequest(), | ||
// getDocumentResponse())); | ||
// } | ||
// | ||
// @Test | ||
// void getFoods3() throws Exception { | ||
// ResultActions resultActions = | ||
// mockMvc.perform( | ||
// RestDocumentationRequestBuilders.get("/v1/foods?keyword=구이") | ||
// .contentType(MediaType.APPLICATION_JSON)); | ||
// | ||
// String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// | ||
// resultActions | ||
// .andExpect(status().isOk()) | ||
// .andDo( | ||
// document( | ||
// "get-foods-searchForKeyword-success", | ||
// getDocumentRequest(), | ||
// getDocumentResponse())); | ||
// } | ||
// | ||
// @Test | ||
// void getFoods4() throws Exception { | ||
// ResultActions resultActions = | ||
// mockMvc.perform( | ||
// RestDocumentationRequestBuilders.get( | ||
// "/v1/foods?keyword=구이&lastFoodName=닭발구이") | ||
// .contentType(MediaType.APPLICATION_JSON)); | ||
// | ||
// String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// | ||
// resultActions | ||
// .andExpect(status().isOk()) | ||
// .andDo( | ||
// document( | ||
// "get-foods-searchForKeywordAndLastFoodName-success", | ||
// getDocumentRequest(), | ||
// getDocumentResponse())); | ||
// } | ||
// package com.gaebaljip.exceed.food; | ||
// | ||
// import static com.gaebaljip.exceed.common.util.ApiDocumentUtil.getDocumentRequest; | ||
// import static com.gaebaljip.exceed.common.util.ApiDocumentUtil.getDocumentResponse; | ||
// import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
// import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
// | ||
// import org.junit.jupiter.api.AfterEach; | ||
// import org.junit.jupiter.api.BeforeEach; | ||
// import org.junit.jupiter.api.Test; | ||
// import org.springframework.beans.factory.annotation.Autowired; | ||
// import org.springframework.boot.ApplicationArguments; | ||
// import org.springframework.boot.test.context.SpringBootTest; | ||
// import org.springframework.http.MediaType; | ||
// import org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders; | ||
// import org.springframework.test.web.servlet.ResultActions; | ||
// | ||
// import com.gaebaljip.exceed.common.EatCeedStaticMessage; | ||
// import com.gaebaljip.exceed.common.IntegrationTest; | ||
// import com.gaebaljip.exceed.infrastructure.redis.RedisAutoComplete; | ||
// import com.gaebaljip.exceed.infrastructure.redis.RedisUtils; | ||
// | ||
// import lombok.extern.log4j.Log4j2; | ||
// | ||
// @SpringBootTest(args = "../food_data.csv") | ||
// @Log4j2 | ||
// public class GetFoodIntegrationTest extends IntegrationTest { | ||
// String PRE_FIX = "prefix"; | ||
// | ||
// @Autowired private RedisUtils redisUtils; | ||
// @Autowired private ApplicationArguments applicationArguments; | ||
// | ||
// @BeforeEach | ||
// void setUp() { | ||
// RedisAutoComplete redisAutoComplete = new RedisAutoComplete(redisUtils); | ||
// try { | ||
// redisAutoComplete.run(applicationArguments); | ||
// } catch (Exception e) { | ||
// log.error("Failed to read CSV file: {}", e.getMessage()); | ||
// } | ||
// } | ||
// | ||
// @AfterEach | ||
// void tearDown() { | ||
// redisUtils.deleteData(EatCeedStaticMessage.REDIS_AUTO_COMPLETE_KEY); | ||
// } | ||
// | ||
// @Test | ||
// void getFoods() throws Exception { | ||
// // given | ||
// String prefix = "감"; | ||
// | ||
// ResultActions resultActions = | ||
// mockMvc.perform( | ||
// RestDocumentationRequestBuilders.get("/v1/foods/auto") | ||
// .queryParam(PRE_FIX, prefix) | ||
// .contentType(MediaType.APPLICATION_JSON)); | ||
// | ||
// String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// | ||
// resultActions | ||
// .andExpect(status().isOk()) | ||
// .andDo( | ||
// document( | ||
// "get-food-noQueryString-success", | ||
// getDocumentRequest(), | ||
// getDocumentResponse())); | ||
// } | ||
// } | ||
// // @Test | ||
// // void getFoods1() throws Exception { | ||
// // | ||
// // ResultActions resultActions = | ||
// // mockMvc.perform( | ||
// // RestDocumentationRequestBuilders.get("/v1/foods") | ||
// // .param(PRE_FIX,) | ||
// // .contentType(MediaType.APPLICATION_JSON)); | ||
// // | ||
// // String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// // | ||
// // resultActions | ||
// // .andExpect(status().isOk()) | ||
// // .andDo( | ||
// // document( | ||
// // "get-foods-lastFoodName-success", | ||
// // getDocumentRequest(), | ||
// // getDocumentResponse())); | ||
// // } | ||
// // | ||
// // @Test | ||
// // void getFoods2() throws Exception { | ||
// // ResultActions resultActions = | ||
// // mockMvc.perform( | ||
// // RestDocumentationRequestBuilders.get("/v1/foods?size=15") | ||
// // .contentType(MediaType.APPLICATION_JSON)); | ||
// // | ||
// // String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// // | ||
// // resultActions | ||
// // .andExpect(status().isOk()) | ||
// // .andDo( | ||
// // document( | ||
// // "get-foods-lastFoodNameAndSize-success", | ||
// // getDocumentRequest(), | ||
// // getDocumentResponse())); | ||
// // } | ||
// // | ||
// // @Test | ||
// // void getFoods3() throws Exception { | ||
// // ResultActions resultActions = | ||
// // mockMvc.perform( | ||
// // RestDocumentationRequestBuilders.get("/v1/foods?keyword=구이") | ||
// // .contentType(MediaType.APPLICATION_JSON)); | ||
// // | ||
// // String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// // | ||
// // resultActions | ||
// // .andExpect(status().isOk()) | ||
// // .andDo( | ||
// // document( | ||
// // "get-foods-searchForKeyword-success", | ||
// // getDocumentRequest(), | ||
// // getDocumentResponse())); | ||
// // } | ||
// // | ||
// // @Test | ||
// // void getFoods4() throws Exception { | ||
// // ResultActions resultActions = | ||
// // mockMvc.perform( | ||
// // RestDocumentationRequestBuilders.get( | ||
// // "/v1/foods?keyword=구이&lastFoodName=닭발구이") | ||
// // .contentType(MediaType.APPLICATION_JSON)); | ||
// // | ||
// // String responseBody = resultActions.andReturn().getResponse().getContentAsString(); | ||
// // | ||
// // resultActions | ||
// // .andExpect(status().isOk()) | ||
// // .andDo( | ||
// // document( | ||
// // "get-foods-searchForKeywordAndLastFoodName-success", | ||
// // getDocumentRequest(), | ||
// // getDocumentResponse())); | ||
// // } |