From fe2189e82c62aec9934cd8e668c8b7e03123bfae Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sun, 19 May 2024 17:47:54 +0900 Subject: [PATCH 01/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/GoodsApiApplicationTest.java | 28 ++--- .../controller/GoodsControllerTest2.java | 49 ++++----- .../goods/controller/GoodsExceptionTest.java | 34 +++--- .../goods/repository/GoodsRepositoryTest.java | 50 ++++----- .../goods/service/GoodsServiceTest.java | 102 +++++++++++++----- 5 files changed, 159 insertions(+), 104 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 1840ac0..907f3c7 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -1,7 +1,9 @@ package com.cosmetics.goods; -import com.cosmetics.domain.goods.dto.GoodsItemManagement; import com.cosmetics.domain.goods.dto.GoodsManagement; +import com.cosmetics.domain.goods.dto.GoodsManagementRequest; +import com.cosmetics.domain.goods.dto.GoodsManagementResponse; +import com.cosmetics.domain.goods.dto.item.GoodsItemManagementRequest; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.*; import org.springframework.beans.factory.annotation.Autowired; @@ -30,31 +32,31 @@ public class GoodsApiApplicationTest { @Autowired private TestRestTemplate testRestTemplate; - private static GoodsManagement requestGoods() { + private static GoodsManagementRequest requestGoods() { //item - List items = new ArrayList<>(); + List items = new ArrayList<>(); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() .itemNm("건성용") .itemQty(50).build()); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() .itemNm("지성용") .itemQty(30).build()); - return GoodsManagement.builder() + return GoodsManagementRequest.builder() .category("스킨케어") .goodsNm("닥터스킨") .marketPrice(15000) .salePrice(12000) .supplyPrice(10000) - .vendorId("lv202400002") + .vendorId(1L) .stockQty(80) .brandNm("닥터펫") .saleStartDtime("2024-05-01 00:00:00") .saleEndDtime("2024-08-01 00:00:00") .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .item(items) + .items(items) .build(); } @@ -63,8 +65,10 @@ private static GoodsManagement requestGoods() { @Order(1) public void 상품등록() throws Exception{ String url = "http://localhost:" + port + "/v1/goods"; - GoodsManagement goodsManagement = requestGoods(); - ResponseEntity responseEntity = testRestTemplate.postForEntity(url, goodsManagement, GoodsManagement.class); + GoodsManagementRequest goodsManagementRequest = requestGoods(); + + ResponseEntity responseEntity = testRestTemplate.postForEntity(url, goodsManagementRequest, GoodsManagementResponse.class); + assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED); assertNotNull(responseEntity.getBody().getGoodsNo()); assertThat(responseEntity.getBody().getResultCode()).isEqualTo("0000"); @@ -75,7 +79,7 @@ private static GoodsManagement requestGoods() { @Order(2) public void 상품조회() throws Exception{ String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagement.class,"240501100001"); + ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagement.class,1L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody().getGoodsNm()).isEqualTo("닥터스킨"); } @@ -85,7 +89,7 @@ private static GoodsManagement requestGoods() { @Order(3) public void 상품삭제() throws Exception{ String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, Map.class, "240501100001"); + ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, Map.class, 1L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody().get("resultCode")).isEqualTo("0000"); } diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java index 0bdeae9..4f9a6f6 100644 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java +++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java @@ -3,8 +3,8 @@ import com.cosmetics.api.goods.controller.GoodsController; import com.cosmetics.domain.exception.custom.CustomException; import com.cosmetics.domain.exception.error.GoodsErrorManagement; -import com.cosmetics.domain.goods.dto.GoodsItemManagement; -import com.cosmetics.domain.goods.dto.GoodsManagement; +import com.cosmetics.domain.goods.dto.GoodsManagementRequest; +import com.cosmetics.domain.goods.dto.item.GoodsItemManagementRequest; import com.cosmetics.domain.goods.service.GoodsService; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; +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.MockMvcResultHandlers.print; @@ -29,6 +30,7 @@ /** * 컨트롤러 단위 테스트 + * 들어가면 안되는 필드가 들어갔는지는 어떻게 테스트 할 수 있을까요? */ @WebMvcTest(GoodsController.class) @Slf4j @@ -44,7 +46,7 @@ public class GoodsControllerTest2 { @DisplayName("상품등록 파라미터가 누락되었을 경우_validation handler_MethodArgumentNotValidException 테스트") public void validGoodsTest() throws Exception { //given - GoodsManagement goodsManagement = requestValidGoods(); + GoodsManagementRequest goodsManagement = requestValidGoods(); //when ResultActions resultActions = mockMvc.perform( @@ -58,31 +60,30 @@ public void validGoodsTest() throws Exception { resultActions.andExpect(jsonPath("errorMessage").value("유효하지 않는 값입니다")); resultActions.andExpect(jsonPath("$.fieldErrorList[0].field").value("goodsNm")); resultActions.andExpect(jsonPath("$.fieldErrorList[0].message").value("must not be blank")); - resultActions.andExpect(jsonPath("$.fieldErrorList[1].field").value("item[0].itemNm")); + resultActions.andExpect(jsonPath("$.fieldErrorList[1].field").value("items[0].itemNm")); resultActions.andExpect(jsonPath("$.fieldErrorList[1].message").value("must not be blank")); } @Test @DisplayName("상품등록 시 내부오류로 상품등록이 실패했을 경우_커스텀 예외_CustomExceptionHandler 테스트") public void saveGoodsFailErrorTest() throws Exception { - GoodsManagement goodsManagement = requestGoods(); + GoodsManagementRequest goodsManagement = requestGoods(); - given(goodsService.save(goodsManagement)).willThrow(new CustomException(GoodsErrorManagement.GOODS_SAVE_ERROR)); + //given(goodsService.save(goodsManagement.toServiceDto())).willThrow(new CustomException(GoodsErrorManagement.GOODS_SAVE_ERROR)); + given(goodsService.save(any())).willThrow(new CustomException(GoodsErrorManagement.GOODS_SAVE_ERROR)); //when ResultActions resultActions = mockMvc.perform( post("http://localhost:8080/v1/goods") .contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(goodsManagement))); resultActions.andDo(print()).andExpect(jsonPath("errorCode").value("GOODS_SAVE_ERROR")); - - //확인필요 실패 illegalGoodsTest는 되는데 왜 이거는 안되는지 도저히 모르겠습니다 } @Test @DisplayName("삭제할 상품번호가 존재하지 않습니다_IllegalArgumentExceptionHandler 테스트 ") public void illegalGoodsTest() throws Exception { - String goodsNo = "2024050100001"; - given(goodsService.deleteGoods(goodsNo)).willThrow(new IllegalArgumentException("존재하지 않는 상품입니다")); + Long goodsNo = 1L; + given(goodsService.deleteByGoodsNo(goodsNo)).willThrow(new IllegalArgumentException("존재하지 않는 상품입니다")); mockMvc.perform(MockMvcRequestBuilders.delete("http://localhost:8080/v1/goods/{goodsNo}", goodsNo)) .andDo(print()) @@ -91,59 +92,59 @@ public void illegalGoodsTest() throws Exception { .andExpect(jsonPath("errorMessage").value("존재하지 않는 상품입니다")); } - private static GoodsManagement requestGoods() { + private static GoodsManagementRequest requestGoods() { //item - List items = new ArrayList<>(); + List items = new ArrayList<>(); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() .itemNm("건성용") .itemQty(50).build()); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() .itemNm("지성용") .itemQty(30).build()); - return GoodsManagement.builder() + return GoodsManagementRequest.builder() .category("스킨케어") .goodsNm("닥터스킨") .marketPrice(15000) .salePrice(12000) .supplyPrice(10000) - .vendorId("lv202400002") + .vendorId(1L) .stockQty(80) .brandNm("닥터펫") .saleStartDtime("2024-05-01 00:00:00") .saleEndDtime("2024-08-01 00:00:00") .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .item(items) + .items(items) .build(); } - private static GoodsManagement requestValidGoods() { + private static GoodsManagementRequest requestValidGoods() { //item - List items = new ArrayList<>(); + List items = new ArrayList<>(); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() //.itemNm("건성용") .itemQty(50).build()); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() .itemNm("지성용") .itemQty(30).build()); - return GoodsManagement.builder() + return GoodsManagementRequest.builder() .category("스킨케어") //.goodsNm("닥터스킨") .marketPrice(15000) .salePrice(12000) .supplyPrice(10000) - .vendorId("lv202400002") + .vendorId(1L) .stockQty(80) .brandNm("닥터펫") .saleStartDtime("2024-05-01 00:00:00") .saleEndDtime("2024-08-01 00:00:00") .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .item(items) + .items(items) .build(); } diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java index 34eefd6..263f687 100644 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java @@ -1,12 +1,17 @@ package com.cosmetics.goods.controller; -import com.cosmetics.domain.goods.dto.GoodsItemManagement; +import com.cosmetics.domain.exception.custom.CustomException; import com.cosmetics.domain.goods.dto.GoodsManagement; +import com.cosmetics.domain.goods.dto.GoodsManagementRequest; +import com.cosmetics.domain.goods.dto.item.GoodsItemManagementRequest; +import com.cosmetics.domain.goods.entity.GoodsManagementEntity; import com.cosmetics.domain.goods.repository.GoodsRepository; import com.cosmetics.domain.goods.service.GoodsService; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; @@ -19,6 +24,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; @@ -32,6 +38,7 @@ @SpringBootTest @AutoConfigureMockMvc +@Slf4j public class GoodsExceptionTest { @Autowired @@ -40,16 +47,13 @@ public class GoodsExceptionTest { @Autowired private MockMvc mockMvc; - @MockBean - private GoodsRepository goodsRepository; - @Test @DisplayName("상품등록 시 내부오류로 상품등록이 실패했을 경우_커스텀 예외_CustomExceptionHandler 테스트") public void saveGoodsFailErrorTest() throws Exception { - GoodsManagement goodsManagement = requestGoods(); - - doReturn(null).when(goodsRepository).save(any(GoodsManagement.class)); -// Body = {"resultCode":"0000","resultMsg":"등록성공","goodsNo":"240501100001","category":"스킨케어","goodsNm":"닥터스킨","salePrice":12000,"marketPrice":15000,"supplyPrice":10000,"vendorId":"lv202400002","stockQty":80,"brandNm":"닥터펫","saleStartDtime":"2024-05-01 00:00:00","saleEndDtime":"2024-08-01 00:00:00","item":[{"itemNo":null,"itemNm":"건성용","itemQty":50},{"itemNo":null,"itemNm":"지성용","itemQty":30}],"image":"https://cdn.localhost:8081/images/lv202400002/goods/image_1.png","addImage":"https://cdn.localhost:8081/images/lv202400002/goods/image_2.png"} + GoodsManagementRequest goodsManagement = requestGoods(); + //테스트실패 + //java.lang.NullPointerException: Cannot invoke "com.cosmetics.domain.goods.dto.GoodsManagement.toEntity()" because "goodsManagement" is null + when(goodsService.save(any(GoodsManagement.class))).thenThrow(CustomException.class); mockMvc.perform( post("http://localhost:8080/v1/goods") @@ -59,31 +63,31 @@ public void saveGoodsFailErrorTest() throws Exception { .andExpect(jsonPath("errorMessage").value("상품 등록에 실패하였습니다 잠시 후에 시도해 주세요")); } - private static GoodsManagement requestGoods() { + private static GoodsManagementRequest requestGoods() { //item - List items = new ArrayList<>(); + List items = new ArrayList<>(); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() .itemNm("건성용") .itemQty(50).build()); - items.add(GoodsItemManagement.builder() + items.add(GoodsItemManagementRequest.builder() .itemNm("지성용") .itemQty(30).build()); - return GoodsManagement.builder() + return GoodsManagementRequest.builder() .category("스킨케어") .goodsNm("닥터스킨") .marketPrice(15000) .salePrice(12000) .supplyPrice(10000) - .vendorId("lv202400002") + .vendorId(1L) .stockQty(80) .brandNm("닥터펫") .saleStartDtime("2024-05-01 00:00:00") .saleEndDtime("2024-08-01 00:00:00") .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .item(items) + .items(items) .build(); } } diff --git a/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java b/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java index c10cd66..5b2c9b3 100644 --- a/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java +++ b/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java @@ -1,47 +1,39 @@ package com.cosmetics.goods.repository; -import com.cosmetics.domain.goods.dto.GoodsItemManagement; import com.cosmetics.domain.goods.dto.GoodsManagement; -import com.cosmetics.domain.goods.repository.GoodsRepository; -import com.fasterxml.jackson.databind.ObjectMapper; +import com.cosmetics.domain.goods.dto.item.GoodsItemManagement; +import com.cosmetics.domain.goods.entity.GoodsManagementEntity; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; import org.mockito.junit.jupiter.MockitoExtension; import java.util.ArrayList; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.assertj.core.api.Assertions.assertThat; -/** - * 레파지토리테스트는 싱글톤으로 해놔서 해놓는거지 jpa할 경우에는 필요없다 - */ @ExtendWith(MockitoExtension.class) +@Slf4j public class GoodsRepositoryTest { - @InjectMocks - private GoodsRepository goodsRepository; - - @Test - public void 상품등록() throws Exception { + @Test() + @DisplayName("상품 서비스 객체가 상품 엔티티로 정상 변환된다.") + public void 상품서비스객체_엔티티_변환() throws Exception { //given - GoodsManagement goodsManagement = requestGoods(); + GoodsManagement requestGoods = requestGoods(); - //when - goodsRepository.save(goodsManagement); + //when dto->entity + GoodsManagementEntity goodsManagementEntity = requestGoods.toEntity(); - System.out.println(new ObjectMapper().writeValueAsString(goodsManagement)); //then - assertNotNull(goodsManagement.getGoodsNo()); - - } - - @Test - public void 상품조회() throws Exception { - 상품등록(); - GoodsManagement goodsManagement = goodsRepository.findGoods("240501100001"); - assertNotNull(goodsManagement.getGoodsNm()); + assertThat(goodsManagementEntity).usingRecursiveComparison().ignoringFields("items", "insertDtime", "updateDtime").isEqualTo(requestGoods); + //상품의 옵션 + assertThat(requestGoods.getItems()).hasSize(goodsManagementEntity.getItems().size()); + for (int i = 0; i < requestGoods.getItems().size(); i++) { + assertThat(goodsManagementEntity.getItems().get(i)).usingRecursiveComparison().ignoringFields("insertDtime", "goodsManagementEntity", "updateDtime").isEqualTo(requestGoods.getItems().get(i)); + } } private static GoodsManagement requestGoods() { @@ -56,19 +48,19 @@ private static GoodsManagement requestGoods() { .itemQty(30).build()); return GoodsManagement.builder() - .category("스킨케어") + .category("스킨케어_test") .goodsNm("닥터스킨") .marketPrice(15000) .salePrice(12000) .supplyPrice(10000) - .vendorId("lv202400002") + .vendorId(1L) .stockQty(80) .brandNm("닥터펫") .saleStartDtime("2024-05-01 00:00:00") .saleEndDtime("2024-08-01 00:00:00") .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .item(items) + .items(items) .build(); } } diff --git a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java index 8be50e8..de4988b 100644 --- a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +++ b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java @@ -1,9 +1,11 @@ package com.cosmetics.goods.service; -import com.cosmetics.domain.goods.dto.GoodsItemManagement; import com.cosmetics.domain.goods.dto.GoodsManagement; +import com.cosmetics.domain.goods.dto.GoodsManagementResponse; +import com.cosmetics.domain.goods.dto.item.GoodsItemManagement; +import com.cosmetics.domain.goods.entity.GoodsManagementEntity; import com.cosmetics.domain.goods.repository.GoodsRepository; -import com.cosmetics.domain.goods.service.impl.GoodsServiceImpl; +import com.cosmetics.domain.goods.service.GoodsService; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -13,10 +15,12 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; /** * 단위 테스트 @@ -29,46 +33,94 @@ * 컨트롤러테스트는 보통 통합 테스트를 하는경우가 많다. * 서비스 비즈니스 테스트가 대부분 */ + +/** + * 상품 서비스 테스트 시나리오 + * [상품등록] + * 등록된 상품엔티티가 서비스 객체로 정상 변환된다. + * 서비스 객체가 컨트롤러에 반환될 응답객체로 정상 변환된다. + * 상품등록이 정상적으로 응답값으로 0000, "등록성공" 이 업데이트 된다. + + * [상품조회] + * 조회한 상품이 존재하지 않는경우 익셉션을 발생시킨다. + * 상품조회가 정상적으로 조회된다. + */ @ExtendWith(MockitoExtension.class) public class GoodsServiceTest { @InjectMocks - private GoodsServiceImpl goodsService; + private GoodsService goodsService; @Mock private GoodsRepository goodsRepository; @Test - @DisplayName("상품등록") - public void 상품등록() throws Exception { + @DisplayName("등록된 상품 엔티티가 서비스 객체로 정상 변환된다.") + public void 엔티티_서비스객체_변환() throws Exception { + //given + GoodsManagementEntity goodsEntity = responseGoods().toEntity(); + + //when entity -> dto + GoodsManagement goodsManagement = GoodsManagement.toDto(goodsEntity); + + //then + assertThat(goodsManagement).usingRecursiveComparison().ignoringFields("items", "insertDtime", "updateDtime").isEqualTo(goodsEntity); + } + + @Test + @DisplayName("서비스 객체가 컨트롤러에 반환될 응답객체로 정상 변환된다.") + public void 서비스객체_응답객체_변환() throws Exception { + //given + GoodsManagementEntity goodsEntity = responseGoods().toEntity(); + GoodsManagement goodsManagement = GoodsManagement.toDto(goodsEntity); + //when dto -> response + GoodsManagementResponse goodsManagementResponse = GoodsManagementResponse.toResponseDto(goodsManagement); + + //then + assertThat(goodsManagementResponse).usingRecursiveComparison().ignoringFields("resultCode", "resultMsg").isEqualTo(goodsManagement); + } + + @Test + @DisplayName("상품등록에 성공한다.") + public void 상품등록() throws Exception { //given GoodsManagement requestGoods = requestGoods(); GoodsManagement responseGoods = responseGoods(); - - //어떤 상품이어도 responseGoods가 반환되어야한다. 근데 any에 왜 requestGoods를 넣으면 오류가 나는지 이해가 안간다.ㅠ - doReturn(responseGoods).when(goodsRepository).save(any(GoodsManagement.class)); + GoodsManagementEntity responseEntity = responseGoods.toEntity(); //when - GoodsManagement resultGoods = goodsService.save(requestGoods); + when(goodsRepository.save(any(GoodsManagementEntity.class))).thenReturn(responseEntity); - assertThat(resultGoods.getGoodsNo()).isEqualTo("2024050100001"); + //then + GoodsManagementResponse resultGoods = goodsService.save(requestGoods); + + assertThat(resultGoods.getGoodsNo()).isEqualTo(1L); + assertThat(resultGoods.getResultCode()).isEqualTo("0000"); + assertThat(resultGoods.getResultMsg()).isEqualTo("등록성공"); } @Test - @DisplayName("상품조회") - public void 상품조회() throws Exception { + @DisplayName("조회한 상품이 존재하지 않는경우 익셉션을 발생시킨다.") + public void 상품_미존재() throws Exception { + assertThrows(IllegalArgumentException.class, () -> { + goodsService.findByGoodsNo(222L); + }); + } + @Test + @DisplayName("상품조회에 성공한다.") + public void 상품조회() throws Exception { //given GoodsManagement responseGoods = responseGoods(); + GoodsManagementEntity responseEntity = responseGoods.toEntity(); - doReturn(responseGoods).when(goodsRepository).findGoods(any(String.class)); + when(goodsRepository.findByGoodsNo(any(Long.class))).thenReturn(Optional.of(responseEntity)); //when - GoodsManagement resultGoods = goodsRepository.findGoods("2024050100001"); + GoodsManagementResponse resultGoods = goodsService.findByGoodsNo(1L); - assertThat(resultGoods.getGoodsNo()).isEqualTo("2024050100001"); - assertThat(resultGoods.getGoodsNm()).isEqualTo("닥터스킨"); - assertThat(resultGoods.getItem().get(1).getItemNm()).isEqualTo("지성용"); + assertThat(resultGoods.getGoodsNo()).isEqualTo(1L); + assertThat(resultGoods.getItems().get(0).getItemNo()).isEqualTo(1L); } private static GoodsManagement requestGoods() { @@ -88,14 +140,14 @@ private static GoodsManagement requestGoods() { .marketPrice(15000) .salePrice(12000) .supplyPrice(10000) - .vendorId("lv202400002") + .vendorId(1L) .stockQty(80) .brandNm("닥터펫") .saleStartDtime("2024-05-01 00:00:00") .saleEndDtime("2024-08-01 00:00:00") .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .item(items) + .items(items) .build(); } @@ -104,27 +156,29 @@ private static GoodsManagement responseGoods() { List items = new ArrayList<>(); items.add(GoodsItemManagement.builder() + .itemNo(1L) .itemNm("건성용") .itemQty(50).build()); items.add(GoodsItemManagement.builder() + .itemNo(2L) .itemNm("지성용") .itemQty(30).build()); return GoodsManagement.builder() -// .goodsNo("2024050100001") + .goodsNo(1L) .category("스킨케어") .goodsNm("닥터스킨") .marketPrice(15000) .salePrice(12000) .supplyPrice(10000) - .vendorId("lv202400002") + .vendorId(1l) .stockQty(80) .brandNm("닥터펫") .saleStartDtime("2024-05-01 00:00:00") .saleEndDtime("2024-08-01 00:00:00") .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .item(items) + .items(items) .build(); } From 52de091741f53d9afc0dd1836f7fe72b26caecd3 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sun, 19 May 2024 18:20:07 +0900 Subject: [PATCH 02/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cosmetics/goods/controller/GoodsExceptionTest.java | 5 ----- .../java/com/cosmetics/goods/service/GoodsServiceTest.java | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java index 263f687..6ca0ffc 100644 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java @@ -4,18 +4,14 @@ import com.cosmetics.domain.goods.dto.GoodsManagement; import com.cosmetics.domain.goods.dto.GoodsManagementRequest; import com.cosmetics.domain.goods.dto.item.GoodsItemManagementRequest; -import com.cosmetics.domain.goods.entity.GoodsManagementEntity; -import com.cosmetics.domain.goods.repository.GoodsRepository; import com.cosmetics.domain.goods.service.GoodsService; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.mockito.InjectMocks; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; @@ -23,7 +19,6 @@ import java.util.List; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; diff --git a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java index de4988b..8af7104 100644 --- a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +++ b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java @@ -54,7 +54,7 @@ public class GoodsServiceTest { private GoodsRepository goodsRepository; @Test - @DisplayName("등록된 상품 엔티티가 서비스 객체로 정상 변환된다.") + @DisplayName("상품 엔티티가 서비스 객체로 정상 변환된다.") public void 엔티티_서비스객체_변환() throws Exception { //given GoodsManagementEntity goodsEntity = responseGoods().toEntity(); From 6103cc39ac64d0daf3dee9a476b6ed150343276d Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sun, 19 May 2024 18:29:36 +0900 Subject: [PATCH 03/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/service/GoodsServiceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java index 8af7104..5357e02 100644 --- a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +++ b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java @@ -54,7 +54,7 @@ public class GoodsServiceTest { private GoodsRepository goodsRepository; @Test - @DisplayName("상품 엔티티가 서비스 객체로 정상 변환된다.") + @DisplayName("상품 엔티티가 서비스 객체로 변환된다.") public void 엔티티_서비스객체_변환() throws Exception { //given GoodsManagementEntity goodsEntity = responseGoods().toEntity(); From b12c233edc3296fab0d246787cb575ad0665dc73 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sun, 19 May 2024 18:41:24 +0900 Subject: [PATCH 04/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/service/GoodsServiceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java index 5357e02..ed87227 100644 --- a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +++ b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java @@ -54,7 +54,7 @@ public class GoodsServiceTest { private GoodsRepository goodsRepository; @Test - @DisplayName("상품 엔티티가 서비스 객체로 변환된다.") + @DisplayName("상품 엔티티가 서비스 객체로 변환된다. ") public void 엔티티_서비스객체_변환() throws Exception { //given GoodsManagementEntity goodsEntity = responseGoods().toEntity(); From 4387a4569694e68b76801a62ba8f8bb42cd7abb9 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sun, 19 May 2024 18:52:59 +0900 Subject: [PATCH 05/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/service/GoodsServiceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java index ed87227..5357e02 100644 --- a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +++ b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java @@ -54,7 +54,7 @@ public class GoodsServiceTest { private GoodsRepository goodsRepository; @Test - @DisplayName("상품 엔티티가 서비스 객체로 변환된다. ") + @DisplayName("상품 엔티티가 서비스 객체로 변환된다.") public void 엔티티_서비스객체_변환() throws Exception { //given GoodsManagementEntity goodsEntity = responseGoods().toEntity(); From e53e6f283327f63c2551e89bb29274da98936b30 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sun, 19 May 2024 18:54:36 +0900 Subject: [PATCH 06/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/service/GoodsServiceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java index 5357e02..ed87227 100644 --- a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +++ b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java @@ -54,7 +54,7 @@ public class GoodsServiceTest { private GoodsRepository goodsRepository; @Test - @DisplayName("상품 엔티티가 서비스 객체로 변환된다.") + @DisplayName("상품 엔티티가 서비스 객체로 변환된다. ") public void 엔티티_서비스객체_변환() throws Exception { //given GoodsManagementEntity goodsEntity = responseGoods().toEntity(); From 17b7c738bcb106cc3e3d61fba5a9bc7c63c63c56 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sun, 19 May 2024 19:11:33 +0900 Subject: [PATCH 07/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cosmetics/goods/controller/GoodsControllerTest2.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java index 4f9a6f6..fed38e6 100644 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java +++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java @@ -21,6 +21,8 @@ import java.util.ArrayList; import java.util.List; +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.Matchers.is; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; @@ -58,9 +60,9 @@ public void validGoodsTest() throws Exception { //then resultActions.andExpect(jsonPath("errorCode").value("INVALID_PARAMETER")); resultActions.andExpect(jsonPath("errorMessage").value("유효하지 않는 값입니다")); - resultActions.andExpect(jsonPath("$.fieldErrorList[0].field").value("goodsNm")); + resultActions.andExpect(jsonPath("$.fieldErrorList[0].field").value(anyOf(is("items[0].itemNm"), is("goodsNm")))); resultActions.andExpect(jsonPath("$.fieldErrorList[0].message").value("must not be blank")); - resultActions.andExpect(jsonPath("$.fieldErrorList[1].field").value("items[0].itemNm")); + resultActions.andExpect(jsonPath("$.fieldErrorList[1].field").value(anyOf(is("items[0].itemNm"), is("goodsNm")))); resultActions.andExpect(jsonPath("$.fieldErrorList[1].message").value("must not be blank")); } From 8e7eba3299e7b4c0e3a908d4943b51c893b2ec66 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Tue, 21 May 2024 00:18:15 +0900 Subject: [PATCH 08/39] =?UTF-8?q?#30=20=EC=83=81=ED=92=88=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/GoodsApiApplicationTest.java | 18 ++++++++---------- .../goods/dto/GoodsManagementRequest.java | 5 ++++- .../goods/entity/GoodsManagementEntity.java | 2 +- .../domain/goods/service/GoodsService.java | 1 - 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 907f3c7..67cf5c9 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -63,7 +62,7 @@ private static GoodsManagementRequest requestGoods() { @DisplayName("상품등록") @Test @Order(1) - public void 상품등록() throws Exception{ + public void 상품등록() throws Exception { String url = "http://localhost:" + port + "/v1/goods"; GoodsManagementRequest goodsManagementRequest = requestGoods(); @@ -77,9 +76,9 @@ private static GoodsManagementRequest requestGoods() { @DisplayName("상품조회") @Test @Order(2) - public void 상품조회() throws Exception{ + public void 상품조회() throws Exception { String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagement.class,1L); + ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagement.class, 1L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody().getGoodsNm()).isEqualTo("닥터스킨"); } @@ -87,11 +86,10 @@ private static GoodsManagementRequest requestGoods() { @DisplayName("상품삭제") @Test @Order(3) - public void 상품삭제() throws Exception{ - String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, Map.class, 1L); + public void 상품삭제() throws Exception { + String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; + ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 1L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); - assertThat(responseEntity.getBody().get("resultCode")).isEqualTo("0000"); } @Test @@ -100,8 +98,8 @@ private static GoodsManagementRequest requestGoods() { public void illegalGoodsTest() throws Exception { //통합테스트에서도 이런 테스트를 해보는게 맞는걸까? 확인필요 String goodsNo = "존재하지않는상품번호"; - String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagement.class, goodsNo); + String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; + ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, goodsNo); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST); assertThat(jsonPath("errorCode").value("INVALID_PARAMETER")); assertThat(jsonPath("errorMessage").value("존재하지 않는 상품입니다")); diff --git a/module-domain/src/main/java/com/cosmetics/domain/goods/dto/GoodsManagementRequest.java b/module-domain/src/main/java/com/cosmetics/domain/goods/dto/GoodsManagementRequest.java index 8ca84d0..6344c58 100644 --- a/module-domain/src/main/java/com/cosmetics/domain/goods/dto/GoodsManagementRequest.java +++ b/module-domain/src/main/java/com/cosmetics/domain/goods/dto/GoodsManagementRequest.java @@ -10,7 +10,9 @@ import lombok.Getter; import lombok.NoArgsConstructor; +import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; @Getter @@ -88,7 +90,8 @@ public GoodsManagementRequest(Long goodsNo, } public List toGoodsItemManagementList(List item){ - return item.stream() + return Optional.ofNullable(item).orElse(new ArrayList<>()) + .stream() .map(GoodsItemManagement::new).collect(Collectors.toList()); } diff --git a/module-domain/src/main/java/com/cosmetics/domain/goods/entity/GoodsManagementEntity.java b/module-domain/src/main/java/com/cosmetics/domain/goods/entity/GoodsManagementEntity.java index 29fe677..7469e2c 100644 --- a/module-domain/src/main/java/com/cosmetics/domain/goods/entity/GoodsManagementEntity.java +++ b/module-domain/src/main/java/com/cosmetics/domain/goods/entity/GoodsManagementEntity.java @@ -51,7 +51,7 @@ public class GoodsManagementEntity { @LastModifiedDate private LocalDateTime updateDtime; - @OneToMany(mappedBy = "goodsManagementEntity", cascade = CascadeType.PERSIST) // 보통 외래키가 있는 쪽이 주인, 주인은 mappyedBy를 설정하지 않음 + @OneToMany(mappedBy = "goodsManagementEntity", cascade = CascadeType.PERSIST, orphanRemoval=true) // 보통 외래키가 있는 쪽이 주인, 주인은 mappyedBy를 설정하지 않음 private List items = new ArrayList<>(); private String image; diff --git a/module-domain/src/main/java/com/cosmetics/domain/goods/service/GoodsService.java b/module-domain/src/main/java/com/cosmetics/domain/goods/service/GoodsService.java index 5a65420..dc95c2e 100644 --- a/module-domain/src/main/java/com/cosmetics/domain/goods/service/GoodsService.java +++ b/module-domain/src/main/java/com/cosmetics/domain/goods/service/GoodsService.java @@ -38,7 +38,6 @@ public GoodsManagementResponse save(GoodsManagement goodsManagement) { //dto -> response GoodsManagementResponse resultGoodsManagementResponse = GoodsManagementResponse.toResponseDto(resultGoodsManagement); log.error("{}", resultGoodsManagement.getGoodsNo()); - log.error("{}", resultGoodsManagement.getItems().get(0).getItemNo()); if (resultGoodsManagement.getGoodsNo() != null) { resultGoodsManagementResponse.updateSuccess("0000", "등록성공"); From e15d30801389a7b62fa3f757982acb3a28a609e2 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Tue, 21 May 2024 00:18:26 +0900 Subject: [PATCH 09/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vendor/VendorApiApplicationTest.java | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java index 1c8d8a4..0c3a823 100644 --- a/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java @@ -2,10 +2,12 @@ import com.cosmetics.domain.vendor.dto.VendorManagement; import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -14,56 +16,57 @@ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@Slf4j public class VendorApiApplicationTest { + @LocalServerPort + private int port; @Autowired private TestRestTemplate testRestTemplate; - VendorManagement VendorManagement = new VendorManagement(); + VendorManagement vendorManagement = new VendorManagement(); @BeforeEach public void setUp() throws Exception { - VendorManagement.setVendorNm("달바"); - VendorManagement.setAddr("서울 여의도동 60"); - VendorManagement.setAddrDetail("63빌딩"); - VendorManagement.setBizNo("111-111-111"); - VendorManagement.setPostNo("101-000"); + vendorManagement.setVendorNm("달바"); + vendorManagement.setAddr("서울 여의도동 60"); + vendorManagement.setAddrDetail("63빌딩"); + vendorManagement.setBizNo("111-111-111"); + vendorManagement.setPostNo("101-000"); } @DisplayName("업체등록") @Test @Order(1) public void 업체등록() throws Exception { - String url = "http://localhost:8080/v1/vendor"; - ResponseEntity responseEntity = testRestTemplate.postForEntity(url, VendorManagement, VendorManagement.class); - + String url = "http://localhost:" + port + "/v1/vendor"; + ResponseEntity responseEntity = testRestTemplate.postForEntity(url, vendorManagement, VendorManagement.class); + VendorManagement responseBody = responseEntity.getBody(); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED); - assertThat(responseEntity.getBody().getVendorId()).isEqualTo("lv202400001"); - + assertThat(responseEntity.getBody().getVendorId()).isNotBlank(); + log.error("vendId = {}", responseBody.getVendorId()); } @DisplayName("업체찾기") @Test @Order(2) public void 업체찾기() throws Exception { - String url = "http://localhost:8080/v1/vendor/{vendorId}"; + String url = "http://localhost:" + port + "/v1/vendor/{vendorId}"; ResponseEntity responseEntity = testRestTemplate.getForEntity(url, VendorManagement.class, "lv202400001"); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody().getVendorNm()).isEqualTo("달바"); - ObjectMapper mapper = new ObjectMapper(); - String json = mapper.writeValueAsString(responseEntity.getBody()); - System.out.println(json); } @DisplayName("업체삭제") @Test @Order(3) public void 업체삭제() throws Exception { - String url = "http://localhost:8080/v1/vendor/{vendorId}"; + String url = "http://localhost:" + port + "/v1/vendor/{vendorId}"; ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, VendorManagement.class, "lv202400001"); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); - assertThat(responseEntity.getBody().getResultCode()).isEqualTo("0000"); + assertThat(responseEntity.getBody().getVendorId()).isNotBlank(); + log.error("vendId = {}", responseEntity.getBody().getVendorId()); } } From f35b4d22a5986b591032b6180e774ed3fd4c62f4 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 02:11:36 +0900 Subject: [PATCH 10/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GoodsControllerTest2.java | 18 +++++++++++++++++ .../goods/controller/GoodsExceptionTest.java | 20 ++++++++++--------- .../sample/ModuleApiApplicationTest.java | 14 ------------- 3 files changed, 29 insertions(+), 23 deletions(-) delete mode 100644 module-api/src/test/java/com/cosmetics/sample/ModuleApiApplicationTest.java diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java index fed38e6..8a34fb1 100644 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java +++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java @@ -25,6 +25,7 @@ import static org.hamcrest.Matchers.is; import static org.mockito.ArgumentMatchers.any; import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; @@ -150,4 +151,21 @@ private static GoodsManagementRequest requestValidGoods() { .build(); } + + @Test + @DisplayName("상품등록 시 내부오류로 상품등록이 실패했을 경우_커스텀 예외_CustomExceptionHandler 테스트") + public void saveGoodsFailErrorTes2t() throws Exception { + GoodsManagementRequest goodsManagement = requestGoods(); + //테스트실패 + //java.lang.NullPointerException: Cannot invoke "com.cosmetics.domain.goods.dto.GoodsManagement.toEntity()" because "goodsManagement" is null + when(goodsService.save(goodsManagement.toServiceDto())).thenThrow(CustomException.class); + + mockMvc.perform( + post("http://localhost:8080/v1/goods") + .contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(goodsManagement))) + .andDo(print()) + .andExpect(jsonPath("errorCode").value("GOODS_SAVE_ERROR")) + .andExpect(jsonPath("errorMessage").value("상품 등록에 실패하였습니다 잠시 후에 시도해 주세요")); + } + } diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java index 6ca0ffc..2b7af43 100644 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java @@ -1,6 +1,7 @@ package com.cosmetics.goods.controller; import com.cosmetics.domain.exception.custom.CustomException; +import com.cosmetics.domain.exception.error.GoodsErrorManagement; import com.cosmetics.domain.goods.dto.GoodsManagement; import com.cosmetics.domain.goods.dto.GoodsManagementRequest; import com.cosmetics.domain.goods.dto.item.GoodsItemManagementRequest; @@ -9,9 +10,14 @@ import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; @@ -25,18 +31,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; /** -* 확인필요 이렇게도 테스트를 할까요?? 커스텀예외를 테스트하기 위해 상품등록시 서비스비즈니스와 컨트롤러 익셉션핸들러 테스트를 해보고 싶었습니다. - * 테스트 실패 - * goodsService 안의 goodsRepository를 건들수가 없어서 성공으로 나오며, 테스트 실패하였습니다 - * 커스텀예외의 핸들러를 테스트하고 싶은데 어떻게 해야할까요? -* */ +익셉션 핸들러 테스트 해보기 + * */ @SpringBootTest @AutoConfigureMockMvc @Slf4j public class GoodsExceptionTest { - @Autowired + @MockBean private GoodsService goodsService; @Autowired @@ -47,11 +50,10 @@ public class GoodsExceptionTest { public void saveGoodsFailErrorTest() throws Exception { GoodsManagementRequest goodsManagement = requestGoods(); //테스트실패 - //java.lang.NullPointerException: Cannot invoke "com.cosmetics.domain.goods.dto.GoodsManagement.toEntity()" because "goodsManagement" is null - when(goodsService.save(any(GoodsManagement.class))).thenThrow(CustomException.class); + when(goodsService.save(any(GoodsManagement.class))).thenThrow(new CustomException(GoodsErrorManagement.GOODS_SAVE_ERROR)); mockMvc.perform( - post("http://localhost:8080/v1/goods") + post("http://localhost:8080/v1/goods") .contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(goodsManagement))) .andDo(print()) .andExpect(jsonPath("errorCode").value("GOODS_SAVE_ERROR")) diff --git a/module-api/src/test/java/com/cosmetics/sample/ModuleApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/sample/ModuleApiApplicationTest.java deleted file mode 100644 index 35c42eb..0000000 --- a/module-api/src/test/java/com/cosmetics/sample/ModuleApiApplicationTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.cosmetics.sample; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -public class ModuleApiApplicationTest { - @Test - public void sysout(){ - System.out.println("입니다."); - - } - -} From a56169abd542fddd0153d1738f4f2ed0b0f018fc Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 02:16:11 +0900 Subject: [PATCH 11/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GoodsControllerTest2.java | 20 +---- .../goods/controller/GoodsExceptionTest.java | 90 ------------------- 2 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java index 8a34fb1..6045a26 100644 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java +++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java @@ -72,7 +72,6 @@ public void validGoodsTest() throws Exception { public void saveGoodsFailErrorTest() throws Exception { GoodsManagementRequest goodsManagement = requestGoods(); - //given(goodsService.save(goodsManagement.toServiceDto())).willThrow(new CustomException(GoodsErrorManagement.GOODS_SAVE_ERROR)); given(goodsService.save(any())).willThrow(new CustomException(GoodsErrorManagement.GOODS_SAVE_ERROR)); //when @@ -80,6 +79,8 @@ public void saveGoodsFailErrorTest() throws Exception { post("http://localhost:8080/v1/goods") .contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(goodsManagement))); resultActions.andDo(print()).andExpect(jsonPath("errorCode").value("GOODS_SAVE_ERROR")); + resultActions.andExpect(jsonPath("errorMessage").value("상품 등록에 실패하였습니다 잠시 후에 시도해 주세요")); + } @Test @@ -151,21 +152,4 @@ private static GoodsManagementRequest requestValidGoods() { .build(); } - - @Test - @DisplayName("상품등록 시 내부오류로 상품등록이 실패했을 경우_커스텀 예외_CustomExceptionHandler 테스트") - public void saveGoodsFailErrorTes2t() throws Exception { - GoodsManagementRequest goodsManagement = requestGoods(); - //테스트실패 - //java.lang.NullPointerException: Cannot invoke "com.cosmetics.domain.goods.dto.GoodsManagement.toEntity()" because "goodsManagement" is null - when(goodsService.save(goodsManagement.toServiceDto())).thenThrow(CustomException.class); - - mockMvc.perform( - post("http://localhost:8080/v1/goods") - .contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(goodsManagement))) - .andDo(print()) - .andExpect(jsonPath("errorCode").value("GOODS_SAVE_ERROR")) - .andExpect(jsonPath("errorMessage").value("상품 등록에 실패하였습니다 잠시 후에 시도해 주세요")); - } - } diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java deleted file mode 100644 index 2b7af43..0000000 --- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.cosmetics.goods.controller; - -import com.cosmetics.domain.exception.custom.CustomException; -import com.cosmetics.domain.exception.error.GoodsErrorManagement; -import com.cosmetics.domain.goods.dto.GoodsManagement; -import com.cosmetics.domain.goods.dto.GoodsManagementRequest; -import com.cosmetics.domain.goods.dto.item.GoodsItemManagementRequest; -import com.cosmetics.domain.goods.service.GoodsService; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MockMvc; - -import java.util.ArrayList; -import java.util.List; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.when; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; - -/** -익셉션 핸들러 테스트 해보기 - * */ - -@SpringBootTest -@AutoConfigureMockMvc -@Slf4j -public class GoodsExceptionTest { - - @MockBean - private GoodsService goodsService; - - @Autowired - private MockMvc mockMvc; - - @Test - @DisplayName("상품등록 시 내부오류로 상품등록이 실패했을 경우_커스텀 예외_CustomExceptionHandler 테스트") - public void saveGoodsFailErrorTest() throws Exception { - GoodsManagementRequest goodsManagement = requestGoods(); - //테스트실패 - when(goodsService.save(any(GoodsManagement.class))).thenThrow(new CustomException(GoodsErrorManagement.GOODS_SAVE_ERROR)); - - mockMvc.perform( - post("http://localhost:8080/v1/goods") - .contentType(MediaType.APPLICATION_JSON).content(new ObjectMapper().writeValueAsString(goodsManagement))) - .andDo(print()) - .andExpect(jsonPath("errorCode").value("GOODS_SAVE_ERROR")) - .andExpect(jsonPath("errorMessage").value("상품 등록에 실패하였습니다 잠시 후에 시도해 주세요")); - } - - private static GoodsManagementRequest requestGoods() { - //item - List items = new ArrayList<>(); - - items.add(GoodsItemManagementRequest.builder() - .itemNm("건성용") - .itemQty(50).build()); - items.add(GoodsItemManagementRequest.builder() - .itemNm("지성용") - .itemQty(30).build()); - - return GoodsManagementRequest.builder() - .category("스킨케어") - .goodsNm("닥터스킨") - .marketPrice(15000) - .salePrice(12000) - .supplyPrice(10000) - .vendorId(1L) - .stockQty(80) - .brandNm("닥터펫") - .saleStartDtime("2024-05-01 00:00:00") - .saleEndDtime("2024-08-01 00:00:00") - .image("https://cdn.localhost:8081/images/lv202400002/goods/image_1.png") - .addImage("https://cdn.localhost:8081/images/lv202400002/goods/image_2.png") - .items(items) - .build(); - } -} From 85b846bc14023ddd37fc4cd08280f5b047b69b78 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 02:48:55 +0900 Subject: [PATCH 12/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4_24,_12_40\342\200\257AM_[Changes].patch" | 314 ++++++++++++++++++ .../goods/GoodsApiApplicationTest.java | 5 +- 2 files changed, 316 insertions(+), 3 deletions(-) create mode 100644 "Uncommitted_changes_before_Checkout_at_5_14_24,_12_40\342\200\257AM_[Changes].patch" diff --git "a/Uncommitted_changes_before_Checkout_at_5_14_24,_12_40\342\200\257AM_[Changes].patch" "b/Uncommitted_changes_before_Checkout_at_5_14_24,_12_40\342\200\257AM_[Changes].patch" new file mode 100644 index 0000000..66c3946 --- /dev/null +++ "b/Uncommitted_changes_before_Checkout_at_5_14_24,_12_40\342\200\257AM_[Changes].patch" @@ -0,0 +1,314 @@ +Subject: [PATCH] Uncommitted changes before Checkout at 5/14/24, 12:40 AM [Changes] +--- +Index: module-domain/src/main/java/com/cosmetics/domain/member/repository/MemberRepository.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-domain/src/main/java/com/cosmetics/domain/member/repository/MemberRepository.java b/module-domain/src/main/java/com/cosmetics/domain/member/repository/MemberRepository.java +--- a/module-domain/src/main/java/com/cosmetics/domain/member/repository/MemberRepository.java ++++ b/module-domain/src/main/java/com/cosmetics/domain/member/repository/MemberRepository.java +@@ -1,14 +1,14 @@ + package com.cosmetics.domain.member.repository; + +-import com.cosmetics.domain.member.dto.MemberManagement; + import com.cosmetics.domain.member.entity.MemberManagementEntity; + import org.springframework.data.jpa.repository.JpaRepository; + import org.springframework.stereotype.Repository; + ++import java.util.Optional; ++ + @Repository + public interface MemberRepository extends JpaRepository { +- +- MemberManagementEntity findByMemberId(Long memberId); ++ Optional findByMemberId(Long memberId); + + MemberManagementEntity save(MemberManagementEntity memberManagementEntity); + +Index: module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java +--- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java ++++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsControllerTest2.java +@@ -3,7 +3,7 @@ + import com.cosmetics.api.goods.controller.GoodsController; + import com.cosmetics.domain.exception.custom.CustomException; + import com.cosmetics.domain.exception.error.GoodsErrorManagement; +-import com.cosmetics.domain.goods.dto.GoodsItemManagement; ++import com.cosmetics.domain.goods.dto.item.GoodsItemManagement; + import com.cosmetics.domain.goods.dto.GoodsManagement; + import com.cosmetics.domain.goods.service.GoodsService; + import com.fasterxml.jackson.databind.ObjectMapper; +@@ -81,8 +81,8 @@ + @Test + @DisplayName("삭제할 상품번호가 존재하지 않습니다_IllegalArgumentExceptionHandler 테스트 ") + public void illegalGoodsTest() throws Exception { +- String goodsNo = "2024050100001"; +- given(goodsService.deleteGoods(goodsNo)).willThrow(new IllegalArgumentException("존재하지 않는 상품입니다")); ++ Long goodsNo = 1L; ++ given(goodsService.deleteByGoodsNo(goodsNo)).willThrow(new IllegalArgumentException("존재하지 않는 상품입니다")); + + mockMvc.perform(MockMvcRequestBuilders.delete("http://localhost:8080/v1/goods/{goodsNo}", goodsNo)) + .andDo(print()) +Index: module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +--- a/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java ++++ b/module-domain/src/test/java/com/cosmetics/goods/service/GoodsServiceTest.java +@@ -1,9 +1,9 @@ + package com.cosmetics.goods.service; + +-import com.cosmetics.domain.goods.dto.GoodsItemManagement; ++import com.cosmetics.domain.goods.dto.item.GoodsItemManagement; + import com.cosmetics.domain.goods.dto.GoodsManagement; +-import com.cosmetics.domain.goods.repository.GoodsRepository; +-import com.cosmetics.domain.goods.service.impl.GoodsServiceImpl; ++import com.cosmetics.domain.goods.repository.GoodsRepositoryOri; ++import com.cosmetics.domain.goods.service.GoodsService; + import org.junit.jupiter.api.DisplayName; + import org.junit.jupiter.api.Test; + import org.junit.jupiter.api.extension.ExtendWith; +@@ -32,10 +32,10 @@ + @ExtendWith(MockitoExtension.class) + public class GoodsServiceTest { + @InjectMocks +- private GoodsServiceImpl goodsService; ++ private GoodsService goodsService; + + @Mock +- private GoodsRepository goodsRepository; ++ private GoodsRepositoryOri goodsRepositoryOri; + + @Test + @DisplayName("상품등록") +@@ -46,12 +46,12 @@ + GoodsManagement responseGoods = responseGoods(); + + //어떤 상품이어도 responseGoods가 반환되어야한다. 근데 any에 왜 requestGoods를 넣으면 오류가 나는지 이해가 안간다.ㅠ +- doReturn(responseGoods).when(goodsRepository).save(any(GoodsManagement.class)); ++ doReturn(responseGoods).when(goodsRepositoryOri).save(any(GoodsManagement.class)); + + //when +- GoodsManagement resultGoods = goodsService.save(requestGoods); ++ // GoodsManagement resultGoods = goodsService.save(GoodsManagement.toDto(requestGoods.toEntity())); + +- assertThat(resultGoods.getGoodsNo()).isEqualTo("2024050100001"); ++ // assertThat(resultGoods.getGoodsNo()).isEqualTo("2024050100001"); + } + + @Test +@@ -61,10 +61,10 @@ + //given + GoodsManagement responseGoods = responseGoods(); + +- doReturn(responseGoods).when(goodsRepository).findGoods(any(String.class)); ++ doReturn(responseGoods).when(goodsRepositoryOri).findGoods(any(String.class)); + + //when +- GoodsManagement resultGoods = goodsRepository.findGoods("2024050100001"); ++ GoodsManagement resultGoods = goodsRepositoryOri.findGoods("2024050100001"); + + assertThat(resultGoods.getGoodsNo()).isEqualTo("2024050100001"); + assertThat(resultGoods.getGoodsNm()).isEqualTo("닥터스킨"); +@@ -88,7 +88,7 @@ + .marketPrice(15000) + .salePrice(12000) + .supplyPrice(10000) +- .vendorId("lv202400002") ++ .vendorId(1L) + .stockQty(80) + .brandNm("닥터펫") + .saleStartDtime("2024-05-01 00:00:00") +@@ -117,7 +117,7 @@ + .marketPrice(15000) + .salePrice(12000) + .supplyPrice(10000) +- .vendorId("lv202400002") ++ .vendorId(1L) + .stockQty(80) + .brandNm("닥터펫") + .saleStartDtime("2024-05-01 00:00:00") +Index: module-domain/src/main/java/com/cosmetics/domain/member/service/impl/MemberService.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-domain/src/main/java/com/cosmetics/domain/member/service/impl/MemberService.java b/module-domain/src/main/java/com/cosmetics/domain/member/service/impl/MemberService.java +--- a/module-domain/src/main/java/com/cosmetics/domain/member/service/impl/MemberService.java ++++ b/module-domain/src/main/java/com/cosmetics/domain/member/service/impl/MemberService.java +@@ -6,6 +6,7 @@ + import com.cosmetics.domain.member.dto.MemberManagementResponse; + import com.cosmetics.domain.member.entity.MemberManagementEntity; + import com.cosmetics.domain.member.repository.MemberRepository; ++import jakarta.transaction.Transactional; + import lombok.extern.slf4j.Slf4j; + import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.dao.EmptyResultDataAccessException; +@@ -22,17 +23,18 @@ + this.memberRepository = memberRepository; + } + ++ @Transactional + public MemberManagementResponse findMember(Long memberId) { +- MemberManagementEntity saveEntity = memberRepository.findByMemberId(memberId); ++ MemberManagementEntity saveEntity = memberRepository.findByMemberId(memberId).orElseThrow(() -> new IllegalArgumentException("회원이 존재하지 않습니다.")); + +- if(saveEntity == null) { +- throw new IllegalArgumentException("회원이 존재하지 않습니다."); +- } ++ //entity -> dto + MemberManagement memberManagement = MemberManagement.toDto(saveEntity); + ++ //dto -> response + return MemberManagementResponse.toResponse(memberManagement); + } + ++ @Transactional + public MemberManagementResponse save(MemberManagement memberManagement) { + //save + MemberManagementEntity saveEntity = memberRepository.save(memberManagement.toEntity()); +@@ -51,6 +53,7 @@ + return response; + } + ++ @Transactional + public void deleteMember(Long memberId) { + try { + memberRepository.deleteByMemberId(memberId); +Index: module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java b/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java +--- a/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java ++++ b/module-domain/src/test/java/com/cosmetics/goods/repository/GoodsRepositoryTest.java +@@ -1,8 +1,8 @@ + package com.cosmetics.goods.repository; + +-import com.cosmetics.domain.goods.dto.GoodsItemManagement; ++import com.cosmetics.domain.goods.dto.item.GoodsItemManagement; + import com.cosmetics.domain.goods.dto.GoodsManagement; +-import com.cosmetics.domain.goods.repository.GoodsRepository; ++import com.cosmetics.domain.goods.repository.GoodsRepositoryOri; + import com.fasterxml.jackson.databind.ObjectMapper; + import org.junit.jupiter.api.Test; + import org.junit.jupiter.api.extension.ExtendWith; +@@ -21,7 +21,7 @@ + public class GoodsRepositoryTest { + + @InjectMocks +- private GoodsRepository goodsRepository; ++ private GoodsRepositoryOri goodsRepositoryOri; + + @Test + public void 상품등록() throws Exception { +@@ -29,7 +29,7 @@ + GoodsManagement goodsManagement = requestGoods(); + + //when +- goodsRepository.save(goodsManagement); ++ goodsRepositoryOri.save(goodsManagement); + + System.out.println(new ObjectMapper().writeValueAsString(goodsManagement)); + //then +@@ -40,7 +40,7 @@ + @Test + public void 상품조회() throws Exception { + 상품등록(); +- GoodsManagement goodsManagement = goodsRepository.findGoods("240501100001"); ++ GoodsManagement goodsManagement = goodsRepositoryOri.findGoods("240501100001"); + assertNotNull(goodsManagement.getGoodsNm()); + } + +Index: module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java +--- a/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java ++++ b/module-api/src/test/java/com/cosmetics/goods/controller/GoodsExceptionTest.java +@@ -1,8 +1,8 @@ + package com.cosmetics.goods.controller; + +-import com.cosmetics.domain.goods.dto.GoodsItemManagement; ++import com.cosmetics.domain.goods.dto.item.GoodsItemManagement; + import com.cosmetics.domain.goods.dto.GoodsManagement; +-import com.cosmetics.domain.goods.repository.GoodsRepository; ++import com.cosmetics.domain.goods.repository.GoodsRepositoryOri; + import com.cosmetics.domain.goods.service.GoodsService; + import com.fasterxml.jackson.databind.ObjectMapper; + import org.junit.jupiter.api.DisplayName; +@@ -41,14 +41,14 @@ + private MockMvc mockMvc; + + @MockBean +- private GoodsRepository goodsRepository; ++ private GoodsRepositoryOri goodsRepositoryOri; + + @Test + @DisplayName("상품등록 시 내부오류로 상품등록이 실패했을 경우_커스텀 예외_CustomExceptionHandler 테스트") + public void saveGoodsFailErrorTest() throws Exception { + GoodsManagement goodsManagement = requestGoods(); + +- doReturn(null).when(goodsRepository).save(any(GoodsManagement.class)); ++ doReturn(null).when(goodsRepositoryOri).save(any(GoodsManagement.class)); + // Body = {"resultCode":"0000","resultMsg":"등록성공","goodsNo":"240501100001","category":"스킨케어","goodsNm":"닥터스킨","salePrice":12000,"marketPrice":15000,"supplyPrice":10000,"vendorId":"lv202400002","stockQty":80,"brandNm":"닥터펫","saleStartDtime":"2024-05-01 00:00:00","saleEndDtime":"2024-08-01 00:00:00","item":[{"itemNo":null,"itemNm":"건성용","itemQty":50},{"itemNo":null,"itemNm":"지성용","itemQty":30}],"image":"https://cdn.localhost:8081/images/lv202400002/goods/image_1.png","addImage":"https://cdn.localhost:8081/images/lv202400002/goods/image_2.png"} + + mockMvc.perform( +Index: module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +--- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java ++++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +@@ -1,6 +1,6 @@ + package com.cosmetics.goods; + +-import com.cosmetics.domain.goods.dto.GoodsItemManagement; ++import com.cosmetics.domain.goods.dto.item.GoodsItemManagement; + import com.cosmetics.domain.goods.dto.GoodsManagement; + import lombok.extern.slf4j.Slf4j; + import org.junit.jupiter.api.*; +Index: docker/docker-compose.yml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml +--- a/docker/docker-compose.yml ++++ b/docker/docker-compose.yml +@@ -15,5 +15,6 @@ + MYSQL_DATABASE: mysqldb + MYSQL_USER : dev_1234 + MYSQL_PASSWORD : 1234 ++ TZ: Asia/Seoul + volumes: + mysql: +Index: module-domain/src/main/java/com/cosmetics/domain/vendor/service/impl/VendorServiceImpl.java +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/module-domain/src/main/java/com/cosmetics/domain/vendor/service/impl/VendorServiceImpl.java b/module-domain/src/main/java/com/cosmetics/domain/vendor/service/impl/VendorServiceImpl.java +--- a/module-domain/src/main/java/com/cosmetics/domain/vendor/service/impl/VendorServiceImpl.java ++++ b/module-domain/src/main/java/com/cosmetics/domain/vendor/service/impl/VendorServiceImpl.java +@@ -22,7 +22,7 @@ + VendorManagement resultGoodsMgmt = vendorRepository.save(vendorManagement); + + if (resultGoodsMgmt.getVendorId() != null) { +- resultGoodsMgmt.updateSuccess("0000", "등록성공"); ++ // resultGoodsMgmt.updateSuccess("0000", "등록성공"); + } else { + throw new CustomException(VendorErrorManagement.VENDOR_ERROR_MANAGEMENT); + } diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 67cf5c9..17f80cf 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -1,6 +1,5 @@ package com.cosmetics.goods; -import com.cosmetics.domain.goods.dto.GoodsManagement; import com.cosmetics.domain.goods.dto.GoodsManagementRequest; import com.cosmetics.domain.goods.dto.GoodsManagementResponse; import com.cosmetics.domain.goods.dto.item.GoodsItemManagementRequest; @@ -78,7 +77,7 @@ private static GoodsManagementRequest requestGoods() { @Order(2) public void 상품조회() throws Exception { String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagement.class, 1L); + ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagementResponse.class, 2L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody().getGoodsNm()).isEqualTo("닥터스킨"); } @@ -88,7 +87,7 @@ private static GoodsManagementRequest requestGoods() { @Order(3) public void 상품삭제() throws Exception { String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 1L); + ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 2L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); } From d90a28ea3f0632cc6a579a732fd160a6d4b80cc1 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 03:20:30 +0900 Subject: [PATCH 13/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 17f80cf..2dad337 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -41,6 +41,7 @@ private static GoodsManagementRequest requestGoods() { .itemNm("지성용") .itemQty(30).build()); + return GoodsManagementRequest.builder() .category("스킨케어") .goodsNm("닥터스킨") From b5210f42f94de341902c5fe560c4429b868c9184 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 03:47:40 +0900 Subject: [PATCH 14/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 2dad337..16c64ce 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -86,7 +86,7 @@ private static GoodsManagementRequest requestGoods() { @DisplayName("상품삭제") @Test @Order(3) - public void 상품삭제() throws Exception { + public void 상품삭제(){ String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 2L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); From d17311e9c0f8e14c01e85af2b3ef2780ee4fb997 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 03:49:37 +0900 Subject: [PATCH 15/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cosmetics/goods/GoodsApiApplicationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 16c64ce..6cc1007 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -24,7 +24,7 @@ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @Slf4j public class GoodsApiApplicationTest { - @LocalServerPort + /* @LocalServerPort private int port; @Autowired @@ -103,5 +103,5 @@ public void illegalGoodsTest() throws Exception { assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST); assertThat(jsonPath("errorCode").value("INVALID_PARAMETER")); assertThat(jsonPath("errorMessage").value("존재하지 않는 상품입니다")); - } + }*/ } From e0937f3329edbbcd42e1cd29f4e08930f2d75617 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 03:51:50 +0900 Subject: [PATCH 16/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cosmetics/goods/GoodsApiApplicationTest.java | 4 ++-- .../java/com/cosmetics/vendor/VendorApiApplicationTest.java | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 6cc1007..16c64ce 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -24,7 +24,7 @@ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @Slf4j public class GoodsApiApplicationTest { - /* @LocalServerPort + @LocalServerPort private int port; @Autowired @@ -103,5 +103,5 @@ public void illegalGoodsTest() throws Exception { assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST); assertThat(jsonPath("errorCode").value("INVALID_PARAMETER")); assertThat(jsonPath("errorMessage").value("존재하지 않는 상품입니다")); - }*/ + } } diff --git a/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java index 0c3a823..fdd8be0 100644 --- a/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/vendor/VendorApiApplicationTest.java @@ -1,7 +1,6 @@ package com.cosmetics.vendor; import com.cosmetics.domain.vendor.dto.VendorManagement; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.*; import org.springframework.beans.factory.annotation.Autowired; From 252d58e6ca30d2ee0a8c2fbe6c6944dced748dda Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 20:14:40 +0900 Subject: [PATCH 17/39] =?UTF-8?q?#30=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 16c64ce..7d8ba0d 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -35,7 +35,7 @@ private static GoodsManagementRequest requestGoods() { List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() - .itemNm("건성용") + .itemNm("건성용 ") .itemQty(50).build()); items.add(GoodsItemManagementRequest.builder() .itemNm("지성용") From 5b32e4817aa3ce55c21bb997cfb9ef7c68ad6e7a Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 21:09:26 +0900 Subject: [PATCH 18/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/cosmetics/goods/GoodsApiApplicationTest.java | 4 ++-- module-domain/src/main/resources/application.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 7d8ba0d..1170b9e 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -78,7 +78,7 @@ private static GoodsManagementRequest requestGoods() { @Order(2) public void 상품조회() throws Exception { String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagementResponse.class, 2L); + ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagementResponse.class, 3L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody().getGoodsNm()).isEqualTo("닥터스킨"); } @@ -88,7 +88,7 @@ private static GoodsManagementRequest requestGoods() { @Order(3) public void 상품삭제(){ String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 2L); + ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 3L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); } diff --git a/module-domain/src/main/resources/application.properties b/module-domain/src/main/resources/application.properties index 9e19e06..55de8a2 100644 --- a/module-domain/src/main/resources/application.properties +++ b/module-domain/src/main/resources/application.properties @@ -1,5 +1,5 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul +spring.datasource.url=jdbc:mysql://localhost:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul&useLegacyAuth=true spring.datasource.username=dev_1234 spring.datasource.password=1234 From 7067ff8436b034815f86d98033c11a71137ca978 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 21:14:52 +0900 Subject: [PATCH 19/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module-domain/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-domain/src/main/resources/application.properties b/module-domain/src/main/resources/application.properties index 55de8a2..9e19e06 100644 --- a/module-domain/src/main/resources/application.properties +++ b/module-domain/src/main/resources/application.properties @@ -1,5 +1,5 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul&useLegacyAuth=true +spring.datasource.url=jdbc:mysql://localhost:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul spring.datasource.username=dev_1234 spring.datasource.password=1234 From 7a7b39d1ee3ddd9bbc9278afce6f11779c9b6552 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Wed, 22 May 2024 23:54:45 +0900 Subject: [PATCH 20/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module-domain/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-domain/src/main/resources/application.properties b/module-domain/src/main/resources/application.properties index 9e19e06..6f84a84 100644 --- a/module-domain/src/main/resources/application.properties +++ b/module-domain/src/main/resources/application.properties @@ -1,5 +1,5 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul spring.datasource.username=dev_1234 spring.datasource.password=1234 From 915c08b33cd395c3b8d94e7850ba268548a50640 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Thu, 23 May 2024 00:18:51 +0900 Subject: [PATCH 21/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 1170b9e..9355e2a 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -96,7 +96,6 @@ private static GoodsManagementRequest requestGoods() { @Order(4) @DisplayName("삭제할 상품번호가 존재하지 않습니다._ llegalArgumentExceptionHandler 테스트") public void illegalGoodsTest() throws Exception { - //통합테스트에서도 이런 테스트를 해보는게 맞는걸까? 확인필요 String goodsNo = "존재하지않는상품번호"; String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, goodsNo); From 9709f311a516ffe3f3960fd4383d8d0e5b845e92 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Thu, 23 May 2024 01:14:16 +0900 Subject: [PATCH 22/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 9355e2a..b6c582a 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -73,7 +73,7 @@ private static GoodsManagementRequest requestGoods() { assertThat(responseEntity.getBody().getResultCode()).isEqualTo("0000"); } - @DisplayName("상품조회") + @DisplayName("상품 조회") @Test @Order(2) public void 상품조회() throws Exception { From d1f3503c1cfa073fc406238fa71741e04aac75fa Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Thu, 23 May 2024 01:22:13 +0900 Subject: [PATCH 23/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index b6c582a..8bcff5c 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -83,7 +83,7 @@ private static GoodsManagementRequest requestGoods() { assertThat(responseEntity.getBody().getGoodsNm()).isEqualTo("닥터스킨"); } - @DisplayName("상품삭제") + @DisplayName("상품 삭제") @Test @Order(3) public void 상품삭제(){ From ef91e96a70915facff381d5e590a7944d39c122b Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Thu, 23 May 2024 01:25:21 +0900 Subject: [PATCH 24/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 8bcff5c..cd759a9 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -86,7 +86,7 @@ private static GoodsManagementRequest requestGoods() { @DisplayName("상품 삭제") @Test @Order(3) - public void 상품삭제(){ + public void 상품_삭제(){ String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 3L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); From 4fd5056c2dd7c2dc6901004e50f083a5420301d1 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:06:38 +0900 Subject: [PATCH 25/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cosmetics/goods/GoodsApiApplicationTest.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index cd759a9..3153327 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -61,7 +61,6 @@ private static GoodsManagementRequest requestGoods() { @DisplayName("상품등록") @Test - @Order(1) public void 상품등록() throws Exception { String url = "http://localhost:" + port + "/v1/goods"; GoodsManagementRequest goodsManagementRequest = requestGoods(); @@ -75,25 +74,22 @@ private static GoodsManagementRequest requestGoods() { @DisplayName("상품 조회") @Test - @Order(2) public void 상품조회() throws Exception { String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagementResponse.class, 3L); + ResponseEntity responseEntity = testRestTemplate.getForEntity(url, GoodsManagementResponse.class, 1L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); assertThat(responseEntity.getBody().getGoodsNm()).isEqualTo("닥터스킨"); } - @DisplayName("상품 삭제") + /* @DisplayName("상품 삭제") @Test - @Order(3) public void 상품_삭제(){ String url = "http://localhost:" + port + "/v1/goods/{goodsNo}"; - ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 3L); + ResponseEntity responseEntity = testRestTemplate.exchange(url, HttpMethod.DELETE, null, GoodsManagementResponse.class, 26L); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.OK); - } + }*/ @Test - @Order(4) @DisplayName("삭제할 상품번호가 존재하지 않습니다._ llegalArgumentExceptionHandler 테스트") public void illegalGoodsTest() throws Exception { String goodsNo = "존재하지않는상품번호"; From 778c7fb8bf5a98f438ff7ee795671fa8430308b2 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:06:56 +0900 Subject: [PATCH 26/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- my.cnf | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 my.cnf diff --git a/my.cnf b/my.cnf new file mode 100644 index 0000000..36313cc --- /dev/null +++ b/my.cnf @@ -0,0 +1,2 @@ +[mysqld] +lower_case_table_names=1 From 1af4f0337c02177401aa7342aa2d68cdb065b9c2 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:14:17 +0900 Subject: [PATCH 27/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 3153327..1533b1c 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -35,7 +35,7 @@ private static GoodsManagementRequest requestGoods() { List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() - .itemNm("건성용 ") + .itemNm("건성용") .itemQty(50).build()); items.add(GoodsItemManagementRequest.builder() .itemNm("지성용") From 31dff6620367f5636923b910527485338be0e82e Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:23:31 +0900 Subject: [PATCH 28/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module-domain/src/main/resources/application.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-domain/src/main/resources/application.properties b/module-domain/src/main/resources/application.properties index 6f84a84..80d2dae 100644 --- a/module-domain/src/main/resources/application.properties +++ b/module-domain/src/main/resources/application.properties @@ -1,5 +1,5 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://127.0.0.1:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/mysqldb?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul&lower_case_table_names=1 spring.datasource.username=dev_1234 spring.datasource.password=1234 From a43cb6b2d21cf989c86a73ed6aba3834a6a82969 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:36:08 +0900 Subject: [PATCH 29/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 1533b1c..fa26913 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item + //item dd List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From 6386180c29a1e1ccd68a9aeb721f73c5c2b4aecd Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:39:36 +0900 Subject: [PATCH 30/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index fa26913..d2b8183 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item dd + //item dds List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From f7adcbc6258fc45507071eee1e753fd2493572bd Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:50:09 +0900 Subject: [PATCH 31/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index d2b8183..a9d2620 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item dds + //item ddaaas List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From add52cf28780176ceb17ee90b26ca78fc69ad40c Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:52:22 +0900 Subject: [PATCH 32/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index a9d2620..6316bb0 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item ddaaas + //item dddddaaas List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From f2f5d891dd17cf2bd5bfe141525bbdb2ba47d250 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 15:53:33 +0900 Subject: [PATCH 33/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 6316bb0..31e6de6 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item dddddaaas + //item ddddds List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From 0c2710fdabdaf2ac5dccc53cde28b5b58f89c7c7 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 16:27:45 +0900 Subject: [PATCH 34/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 31e6de6..ca4221f 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item ddddds + //item test List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From e3d5332b7c783d35012a7ab6d646beb44dbef20a Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 16:45:27 +0900 Subject: [PATCH 35/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index ca4221f..1d4f1b4 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item test + //item testㅇㅇㅇ List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From b42cfe54e42d7d1307487bd45970f2440ac0a0c6 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 16:47:16 +0900 Subject: [PATCH 36/39] =?UTF-8?q?#30=20mysql=20=EC=84=A4=EC=A0=95=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 1d4f1b4..8b0bf4b 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item testㅇㅇㅇ + //item testㅇㅇㅇ dd List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From caf84b863aad1310f6bf227f44a1a55677b10517 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 16:50:55 +0900 Subject: [PATCH 37/39] =?UTF-8?q?#30=20=EB=90=98=EB=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 8b0bf4b..631bfbc 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item testㅇㅇㅇ dd + //item 왜반영이안되냐 List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From 082ff0efe583425b39f6ab27d4842f0c7a253b51 Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 16:58:03 +0900 Subject: [PATCH 38/39] =?UTF-8?q?#30=20=EB=90=98=EB=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 631bfbc..9d23cbe 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item 왜반영이안되냐 + //item 왜반영이안ddd되냐 List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder() From 6ce55253aeb6f2bec56c381d5d42174a5a316daf Mon Sep 17 00:00:00 2001 From: kimsuyeondev Date: Sat, 25 May 2024 17:03:05 +0900 Subject: [PATCH 39/39] =?UTF-8?q?#30=20=EB=90=98=EB=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/cosmetics/goods/GoodsApiApplicationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java index 9d23cbe..1dae535 100644 --- a/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java +++ b/module-api/src/test/java/com/cosmetics/goods/GoodsApiApplicationTest.java @@ -31,7 +31,7 @@ public class GoodsApiApplicationTest { private TestRestTemplate testRestTemplate; private static GoodsManagementRequest requestGoods() { - //item 왜반영이안ddd되냐 + //item 왜반영이안ddddd되냐 List items = new ArrayList<>(); items.add(GoodsItemManagementRequest.builder()