diff --git a/src/main/java/com/example/green/domain/dashboard/rankingmodule/service/WeeklyRankingScheduler.java b/src/main/java/com/example/green/domain/dashboard/rankingmodule/service/WeeklyRankingScheduler.java index 8ca02b18..4acb7661 100644 --- a/src/main/java/com/example/green/domain/dashboard/rankingmodule/service/WeeklyRankingScheduler.java +++ b/src/main/java/com/example/green/domain/dashboard/rankingmodule/service/WeeklyRankingScheduler.java @@ -20,7 +20,7 @@ public class WeeklyRankingScheduler { /** * 매주 월요일 00:00시 지난 주 랭킹 계산 */ - @Scheduled(cron = "0 23 17 * * THU", zone = "Asia/Seoul") + @Scheduled(cron = "0 0 0 * * MON", zone = "Asia/Seoul") public void calculateWeeklyRankingBatch() { log.info("스케줄러 작동"); diff --git a/src/main/java/com/example/green/domain/pointshop/item/controller/PointItemAdminController.java b/src/main/java/com/example/green/domain/pointshop/item/controller/PointItemAdminController.java index 637c2603..5be7c778 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/controller/PointItemAdminController.java +++ b/src/main/java/com/example/green/domain/pointshop/item/controller/PointItemAdminController.java @@ -30,7 +30,6 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemCode; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; import com.example.green.domain.pointshop.item.repository.PointItemOrderRepository; import com.example.green.domain.pointshop.item.repository.PointItemQueryRepository; import com.example.green.domain.pointshop.item.service.PointItemQueryService; @@ -83,8 +82,7 @@ public NoContent updatePointItem( new ItemCode(updatePointItemRequest.code()), new ItemBasicInfo(updatePointItemRequest.name(), updatePointItemRequest.description()), new ItemMedia(updatePointItemRequest.thumbnailUrl()), - new ItemPrice(updatePointItemRequest.price()), - new ItemStock(updatePointItemRequest.stock()) + new ItemPrice(updatePointItemRequest.price()) ); pointItemService.updatePointItem(command, pointItemId); diff --git a/src/main/java/com/example/green/domain/pointshop/item/dto/request/CreatePointItemRequest.java b/src/main/java/com/example/green/domain/pointshop/item/dto/request/CreatePointItemRequest.java index e2447ac0..925d2d4c 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/dto/request/CreatePointItemRequest.java +++ b/src/main/java/com/example/green/domain/pointshop/item/dto/request/CreatePointItemRequest.java @@ -6,7 +6,6 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemCode; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; import com.example.green.domain.pointshop.item.service.command.PointItemCreateCommand; import io.swagger.v3.oas.annotations.media.Schema; @@ -35,18 +34,14 @@ public record CreatePointItemRequest( String thumbnailUrl, @NotNull(message = "아이템 상품 가격은 필수입니다.") @Schema(description = "아이템 상품 가격", example = "10000") - BigDecimal price, - @NotNull(message = "아이템 상품 재고는 필수입니다") - @Schema(description = "아이템 상품 재고", example = "2") - Integer stock + BigDecimal price ) { public PointItemCreateCommand toCommand() { return new PointItemCreateCommand( new ItemCode(code), new ItemBasicInfo(name, description), new ItemMedia(thumbnailUrl), - new ItemPrice(price), - new ItemStock(stock) + new ItemPrice(price) ); } } diff --git a/src/main/java/com/example/green/domain/pointshop/item/dto/request/UpdatePointItemRequest.java b/src/main/java/com/example/green/domain/pointshop/item/dto/request/UpdatePointItemRequest.java index cf8f6d34..7e1ee4dc 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/dto/request/UpdatePointItemRequest.java +++ b/src/main/java/com/example/green/domain/pointshop/item/dto/request/UpdatePointItemRequest.java @@ -30,10 +30,6 @@ public record UpdatePointItemRequest( @NotNull(message = "아이템 가격은 필수입니다.") @Schema(description = "아이템 가격", example = "10000") - BigDecimal price, - - @NotNull(message = "아이템 수량은 필수입니다") - @Schema(description = "아이템 수량", example = "10") - Integer stock + BigDecimal price ) { } diff --git a/src/main/java/com/example/green/domain/pointshop/item/dto/response/PointItemClientResponse.java b/src/main/java/com/example/green/domain/pointshop/item/dto/response/PointItemClientResponse.java index e9f6d1a5..f6b3700e 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/dto/response/PointItemClientResponse.java +++ b/src/main/java/com/example/green/domain/pointshop/item/dto/response/PointItemClientResponse.java @@ -37,9 +37,6 @@ public class PointItemClientResponse { @Column(nullable = false) private BigDecimal remainPoint; - @Column(nullable = false) - private Integer stock; - public PointItemClientResponse( String itemName, String description, @@ -47,8 +44,7 @@ public PointItemClientResponse( BigDecimal price, BigDecimal enablePoint, BigDecimal decreasePoint, - BigDecimal remainPoint, - Integer stock + BigDecimal remainPoint ) { validateEmptyString(itemName, REQUIRED_ITEM_NAME); validateEmptyString(description, REQUIRED_ITEM_DESCRIPTION); @@ -57,7 +53,6 @@ public PointItemClientResponse( validateNullData(enablePoint, REQUIRED_ENABLE_POINT); validateNullData(decreasePoint, REQUIRED_DECREASE_POINT); validateNullData(remainPoint, REQUIRED_REMAIN_POINT); - validateNullData(stock, REQUIRED_ITEM_STOCK); this.itemName = itemName; this.description = description; @@ -66,7 +61,6 @@ public PointItemClientResponse( this.enablePoint = enablePoint; this.decreasePoint = decreasePoint; this.remainPoint = remainPoint; - this.stock = stock; } public static PointItemClientResponse from(PointItem pointItem, BigDecimal enablePoint, BigDecimal decreasePoint, @@ -78,8 +72,7 @@ public static PointItemClientResponse from(PointItem pointItem, BigDecimal enabl pointItem.getItemPrice().getItemPrice(), enablePoint, decreasePoint, - remainPoint, - pointItem.getItemStock().getStock() + remainPoint ); } } diff --git a/src/main/java/com/example/green/domain/pointshop/item/entity/PointItem.java b/src/main/java/com/example/green/domain/pointshop/item/entity/PointItem.java index 8284fa2d..2a441e51 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/entity/PointItem.java +++ b/src/main/java/com/example/green/domain/pointshop/item/entity/PointItem.java @@ -9,9 +9,6 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemDisplayStatus; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; -import com.example.green.domain.pointshop.item.exception.PointItemException; -import com.example.green.domain.pointshop.product.entity.vo.SellingStatus; import jakarta.persistence.AttributeOverride; import jakarta.persistence.Column; @@ -60,46 +57,32 @@ public class PointItem extends BaseEntity { @Embedded private ItemPrice itemPrice; - @Embedded - private ItemStock itemStock; - - @Column(nullable = false) - @Enumerated(EnumType.STRING) - private SellingStatus sellingStatus; - @Column(nullable = false) @Enumerated(EnumType.STRING) private ItemDisplayStatus displayStatus; @Builder - public PointItem(ItemCode itemCode, ItemBasicInfo itemBasicInfo, ItemMedia itemMedia, ItemPrice itemPrice, - ItemStock itemStock) { - validatePointItem(itemCode, itemBasicInfo, itemMedia, itemPrice, itemStock); + public PointItem(ItemCode itemCode, ItemBasicInfo itemBasicInfo, ItemMedia itemMedia, ItemPrice itemPrice + ) { + validatePointItem(itemCode, itemBasicInfo, itemMedia, itemPrice); this.itemCode = itemCode; this.itemBasicInfo = itemBasicInfo; this.itemMedia = itemMedia; this.itemPrice = itemPrice; - this.itemStock = itemStock; - this.sellingStatus = SellingStatus.EXCHANGEABLE; this.displayStatus = ItemDisplayStatus.DISPLAY; } public static PointItem create(ItemCode itemCode, ItemBasicInfo itemBasicInfo, ItemMedia itemMedia, - ItemPrice itemPrice, ItemStock itemStock) { - return new PointItem(itemCode, itemBasicInfo, itemMedia, itemPrice, itemStock); + ItemPrice itemPrice) { + return new PointItem(itemCode, itemBasicInfo, itemMedia, itemPrice); } private static void validatePointItem(ItemCode itemCode, ItemBasicInfo itemBasicInfo, ItemMedia itemMedia, - ItemPrice itemPrice, ItemStock itemStock) { + ItemPrice itemPrice) { validateNullData(itemCode, REQUIRED_ITEM_CODE); validateNullData(itemBasicInfo, REQUIRED_ITEM_BASIC_INFO); validateNullData(itemMedia, REQUIRED_ITEM_MEDIA); validateNullData(itemPrice, REQUIRED_ITEM_PRICE); - validateNullData(itemStock, REQUIRED_ITEM_STOCK); - if (itemStock.isSoldOut()) { - throw new PointItemException(INVALID_ITEM_STOCK_CREATION); - } - } public void updateItemCode(ItemCode itemCode) { @@ -122,24 +105,6 @@ public void updateItemPrice(ItemPrice itemPrice) { this.itemPrice = itemPrice; } - public void updateItemStock(ItemStock itemStock) { - validateNullData(itemStock, REQUIRED_ITEM_STOCK); - this.itemStock = itemStock; - this.sellingStatus = updateSellingStatus(); - } - - public void decreaseStock(int amount) { - this.itemStock = this.itemStock.decreaseStock(amount); - this.sellingStatus = updateSellingStatus(); - } - - private SellingStatus updateSellingStatus() { - if (this.itemStock.isSoldOut()) { - return SellingStatus.SOLD_OUT; - } - return SellingStatus.EXCHANGEABLE; - } - public boolean isNewImage(ItemMedia media) { return !this.itemMedia.equals(media); } diff --git a/src/main/java/com/example/green/domain/pointshop/item/excel/PointItemExcelMapper.java b/src/main/java/com/example/green/domain/pointshop/item/excel/PointItemExcelMapper.java index b776e150..1bd48b71 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/excel/PointItemExcelMapper.java +++ b/src/main/java/com/example/green/domain/pointshop/item/excel/PointItemExcelMapper.java @@ -35,8 +35,6 @@ public List getFields() { ExcelField.of("아이템 코드", singleBackGroundColor, FieldFormat.TEXT), ExcelField.of("아이템명", singleBackGroundColor, FieldFormat.TEXT), ExcelField.of("아이템 포인트", singleBackGroundColor, FieldFormat.POINT), - ExcelField.of("수량", singleBackGroundColor, FieldFormat.NUMBER), - ExcelField.of("판매 상태", singleBackGroundColor, FieldFormat.TEXT), ExcelField.of("전시 여부", singleBackGroundColor, FieldFormat.TEXT), ExcelField.of("등록일", singleBackGroundColor, FieldFormat.DATE) ); @@ -48,8 +46,6 @@ public Object[] extractRowData(PointItemSearchResponse data) { data.getCode(), data.getName(), data.getPointPrice(), - data.getStockQuantity(), - data.getSellingStatus().getValue(), data.getDisplayStatus().getValue(), data.getCreatedDate() }; diff --git a/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemProjections.java b/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemProjections.java index 0a543deb..654e2e05 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemProjections.java +++ b/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemProjections.java @@ -19,8 +19,6 @@ public static QBean toSearchItemResponse(QPointItem qPo qPointItem.itemCode.code.as("code"), qPointItem.itemBasicInfo.itemName.as("name"), qPointItem.itemPrice.itemPrice.as("pointPrice"), - qPointItem.itemStock.stock.as("stockQuantity"), - qPointItem.sellingStatus, qPointItem.displayStatus, qPointItem.createdDate ); diff --git a/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemQueryExecutor.java b/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemQueryExecutor.java index 8ebf36da..33c4be8f 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemQueryExecutor.java +++ b/src/main/java/com/example/green/domain/pointshop/item/infra/PointItemQueryExecutor.java @@ -56,8 +56,7 @@ public List findItemByCursor(BooleanExpression expression, in qPointItem.id, qPointItem.itemBasicInfo.itemName, qPointItem.itemMedia.itemThumbNailUrl, - qPointItem.itemPrice.itemPrice, - qPointItem.sellingStatus + qPointItem.itemPrice.itemPrice )) .from(qPointItem) .where(expression) diff --git a/src/main/java/com/example/green/domain/pointshop/item/service/PointItemOrderService.java b/src/main/java/com/example/green/domain/pointshop/item/service/PointItemOrderService.java index f49bf1b6..65942bf9 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/service/PointItemOrderService.java +++ b/src/main/java/com/example/green/domain/pointshop/item/service/PointItemOrderService.java @@ -33,7 +33,6 @@ public class PointItemOrderService { private final PointItemOrderRepository pointItemOrderRepository; private final PointItemRepository pointItemRepository; private final PlantGrowthItemRepository plantGrowthItemRepository; - private final PointItemService pointItemService; private final PointClient pointClient; private final MemberRepository memberRepository; private final TimeUtils timeUtils; @@ -64,8 +63,6 @@ public OrderPointItemResponse orderPointItem(OrderPointItemCommand command, throw new PointItemException(PointItemExceptionMessage.NOT_POSSIBLE_BUY_ITEM); } - pointItemService.decreaseItemStock(itemId, amount); - BigDecimal remainPoint = currentPoint.subtract(totalPoint); pointClient.spendPoints( diff --git a/src/main/java/com/example/green/domain/pointshop/item/service/PointItemService.java b/src/main/java/com/example/green/domain/pointshop/item/service/PointItemService.java index 74b74e2c..ec8b90fa 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/service/PointItemService.java +++ b/src/main/java/com/example/green/domain/pointshop/item/service/PointItemService.java @@ -33,8 +33,7 @@ public Long create(PointItemCreateCommand createCommand) { createCommand.itemCode(), createCommand.info(), createCommand.media(), - createCommand.price(), - createCommand.stock() + createCommand.price() ); PointItem savedPointItem = pointItemRepository.save(pointItem); @@ -55,7 +54,6 @@ public void updatePointItem(PointItemUpdateCommand command, Long pointItemId) { pointItem.updateItemBasicInfo(command.info()); pointItem.updateItemMedia(command.media()); pointItem.updateItemPrice(command.price()); - pointItem.updateItemStock(command.stock()); processSideEffect(command, pointItem); } @@ -106,9 +104,4 @@ public void hideItemDisplay(Long pointItemId) { pointItemQueryService.getPointItem(pointItemId).hideItemDisplay(); } - public void decreaseItemStock(Long pointItemId, int amount) { - PointItem pointItem = pointItemQueryService.getPointItem(pointItemId); - pointItem.decreaseStock(amount); - } - } diff --git a/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemCreateCommand.java b/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemCreateCommand.java index dc52b165..8868b358 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemCreateCommand.java +++ b/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemCreateCommand.java @@ -4,14 +4,12 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemCode; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; public record PointItemCreateCommand( ItemCode itemCode, ItemBasicInfo info, ItemMedia media, - ItemPrice price, - ItemStock stock + ItemPrice price ) { } diff --git a/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemUpdateCommand.java b/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemUpdateCommand.java index 2d4b3f82..b6214cbf 100644 --- a/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemUpdateCommand.java +++ b/src/main/java/com/example/green/domain/pointshop/item/service/command/PointItemUpdateCommand.java @@ -4,13 +4,11 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemCode; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; public record PointItemUpdateCommand( ItemCode itemCode, ItemBasicInfo info, ItemMedia media, - ItemPrice price, - ItemStock stock + ItemPrice price ) { } diff --git a/src/main/resources/db/migration/v13__migrate_point_item.sql b/src/main/resources/db/migration/v13__migrate_point_item.sql new file mode 100644 index 00000000..53926c34 --- /dev/null +++ b/src/main/resources/db/migration/v13__migrate_point_item.sql @@ -0,0 +1,9 @@ +-- selling_status 컬럼 삭제 +ALTER TABLE point_item +DROP +COLUMN IF EXISTS selling_status; + +-- stock 컬럼 삭제 +ALTER TABLE point_item +DROP +COLUMN IF EXISTS stock; diff --git a/src/test/java/com/example/green/domain/pointshop/item/controller/DummyData.java b/src/test/java/com/example/green/domain/pointshop/item/controller/DummyData.java index 5e968bbf..ede28468 100644 --- a/src/test/java/com/example/green/domain/pointshop/item/controller/DummyData.java +++ b/src/test/java/com/example/green/domain/pointshop/item/controller/DummyData.java @@ -13,8 +13,7 @@ public static CreatePointItemRequest createPointItemRequest() { "맑은 뭉게 구름", "하늘에서 포근한 구름이 내려와 식물을 감싸요. 몽글몽글 기분 좋은 하루!", "https://thumbnail.url/rainbow-pot.jpg", - BigDecimal.valueOf(450), - 10 + BigDecimal.valueOf(450) ); } @@ -24,8 +23,7 @@ public static UpdatePointItemRequest updatePointItemRequest() { "행운의 네잎클로버", "행운의 네잎클로버가 싱그럽게 피어나요. 오늘 하루도 행운 가득!", "https://thumbnail.url/clover.jpg", - BigDecimal.valueOf(600), - 20 + BigDecimal.valueOf(600) ); } diff --git a/src/test/java/com/example/green/domain/pointshop/item/controller/PointItemOrderServiceControllerTest.java b/src/test/java/com/example/green/domain/pointshop/item/controller/PointItemOrderServiceControllerTest.java index 9fe2036f..6a3612e8 100644 --- a/src/test/java/com/example/green/domain/pointshop/item/controller/PointItemOrderServiceControllerTest.java +++ b/src/test/java/com/example/green/domain/pointshop/item/controller/PointItemOrderServiceControllerTest.java @@ -23,7 +23,6 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemCode; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; import com.example.green.domain.pointshop.item.repository.PointItemRepository; import com.example.green.domain.pointshop.item.service.PointItemOrderService; import com.example.green.domain.pointshop.item.service.command.OrderPointItemCommand; @@ -51,9 +50,8 @@ class PointItemOrderServiceControllerTest extends BaseControllerUnitTest { ItemBasicInfo itemBasicInfo = new ItemBasicInfo("무지개", "행운의 네잎클로버가 싱그럽게 피어나요. 오늘 하루도 행운 가득"); ItemMedia itemMedia = new ItemMedia("https://thumbnail.url/rainbow-pot.jpg"); ItemPrice itemPrice = new ItemPrice(BigDecimal.valueOf(400)); - ItemStock itemStock = new ItemStock(10); - PointItem pointItem = new PointItem(itemCode, itemBasicInfo, itemMedia, itemPrice, itemStock); + PointItem pointItem = new PointItem(itemCode, itemBasicInfo, itemMedia, itemPrice); when(pointItemRepository.findById(itemId)).thenReturn(Optional.of(pointItem)); diff --git a/src/test/java/com/example/green/domain/pointshop/item/service/PointItemOrderServiceTest.java b/src/test/java/com/example/green/domain/pointshop/item/service/PointItemOrderServiceTest.java index 00fc8554..abd39f07 100644 --- a/src/test/java/com/example/green/domain/pointshop/item/service/PointItemOrderServiceTest.java +++ b/src/test/java/com/example/green/domain/pointshop/item/service/PointItemOrderServiceTest.java @@ -91,9 +91,6 @@ void setUp() { given(pointItemRepository.findById(anyLong())) .willReturn(Optional.of(mock(com.example.green.domain.pointshop.item.entity.PointItem.class))); - // Stock 감소 mock - doNothing().when(pointItemService).decreaseItemStock(1L, 4); - // spend 포인트 mock doNothing().when(pointClient).spendPoints(any(PointSpendRequest.class)); @@ -132,45 +129,4 @@ void setUp() { .hasMessage(PointItemExceptionMessage.NOT_POSSIBLE_BUY_ITEM.getMessage()); } - @Test - void 재고가_부족하면_예외발생() { - // given - MemberSnapshot memberSnapshot = new MemberSnapshot(1L, "member_key", "user1@test.com"); - - PointItemSnapshot snapshot = new PointItemSnapshot( - 1L, - "무지개", - "ITM-AA-002", - "https://thumbnail.url/image.jpg", - BigDecimal.valueOf(450) - ); - - OrderPointItemCommand command = new OrderPointItemCommand(memberSnapshot, snapshot); - OrderPointItemRequest request = new OrderPointItemRequest(5); // 구매 요청 수량: 5 - - // member mocking - given(memberRepository.findById(1L)).willReturn(Optional.of(member)); - - // 아이템 존재 - given(pointItemRepository.findById(anyLong())) - .willReturn(Optional.of(mock(com.example.green.domain.pointshop.item.entity.PointItem.class))); - - // 포인트는 충분하다고 가정 (문제 관심사는 재고) - given(pointClient.getTotalPoints(1L)).willReturn(BigDecimal.valueOf(9999)); - - // 재고 부족 상황 mocking - doThrow(new PointItemException(PointItemExceptionMessage.OUT_OF_ITEM_STOCK)) - .when(pointItemService) - .decreaseItemStock(1L, 5); - - // when & then - assertThatThrownBy(() -> pointItemOrderService.orderPointItem(command, request)) - .isInstanceOf(PointItemException.class) - .hasMessage(PointItemExceptionMessage.OUT_OF_ITEM_STOCK.getMessage()); - - // spendPoints, save 등 → 호출되면 안 됨 - verify(pointClient, never()).spendPoints(any()); - verify(pointItemOrderRepository, never()).save(any()); - } - } diff --git a/src/test/java/com/example/green/domain/pointshop/item/service/PointItemQueryServiceTest.java b/src/test/java/com/example/green/domain/pointshop/item/service/PointItemQueryServiceTest.java index ea96d9b8..0ad1e630 100644 --- a/src/test/java/com/example/green/domain/pointshop/item/service/PointItemQueryServiceTest.java +++ b/src/test/java/com/example/green/domain/pointshop/item/service/PointItemQueryServiceTest.java @@ -17,7 +17,6 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemCode; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; import com.example.green.domain.pointshop.item.exception.PointItemException; import com.example.green.domain.pointshop.item.exception.PointItemExceptionMessage; import com.example.green.domain.pointshop.item.repository.PointItemRepository; @@ -75,9 +74,7 @@ class PointItemQueryServiceTest { new ItemCode("ITM-AA-002"), new ItemBasicInfo("무지개 ", "무지개가 식물을 감싸요. 날씨가 좋을 것 같은 하루!"), new ItemMedia("https://thumbnail.url/image.jpg"), - new ItemPrice(BigDecimal.valueOf(450)), - new ItemStock(10) - )); + new ItemPrice(BigDecimal.valueOf(450)))); //when when(repository.findById(anyLong())).thenReturn(Optional.of(dummyEntity)); PointItem pointItem = service.getPointItem(1L); diff --git a/src/test/java/com/example/green/domain/pointshop/item/service/PointItemServiceTest.java b/src/test/java/com/example/green/domain/pointshop/item/service/PointItemServiceTest.java index 8fd83f78..87537685 100644 --- a/src/test/java/com/example/green/domain/pointshop/item/service/PointItemServiceTest.java +++ b/src/test/java/com/example/green/domain/pointshop/item/service/PointItemServiceTest.java @@ -19,7 +19,6 @@ import com.example.green.domain.pointshop.item.entity.vo.ItemCode; import com.example.green.domain.pointshop.item.entity.vo.ItemMedia; import com.example.green.domain.pointshop.item.entity.vo.ItemPrice; -import com.example.green.domain.pointshop.item.entity.vo.ItemStock; import com.example.green.domain.pointshop.item.exception.PointItemException; import com.example.green.domain.pointshop.item.exception.PointItemExceptionMessage; import com.example.green.domain.pointshop.item.repository.PointItemRepository; @@ -81,8 +80,7 @@ class PointItemServiceTest { new ItemCode("ITM-AA-002"), new ItemBasicInfo("무지개 ", "무지개가 식물을 감싸요. 날씨가 좋을 것 같은 하루!"), new ItemMedia("https://thumbnail.url/image.jpg"), - new ItemPrice(BigDecimal.valueOf(450)), - new ItemStock(10) + new ItemPrice(BigDecimal.valueOf(450)) )); when(pointItemQueryService.getPointItem(anyLong())).thenReturn(dummyEntity); when(dummyEntity.isNewImage(command.media())).thenReturn(false); @@ -104,8 +102,7 @@ class PointItemServiceTest { new ItemCode("ITM-AA-002"), new ItemBasicInfo("무지개 ", "무지개가 식물을 감싸요. 날씨가 좋을 것 같은 하루!"), new ItemMedia("https://thumbnail.url/image.jpg"), - new ItemPrice(BigDecimal.valueOf(450)), - new ItemStock(10) + new ItemPrice(BigDecimal.valueOf(450)) )); String oldImageUrl = "https://thumbnail.url/image.jpg"; String newImageUrl = command.media().getItemThumbNailUrl(); @@ -151,8 +148,6 @@ class PointItemServiceTest { when(dummyEntity.getItemMedia()).thenReturn( new ItemMedia("https://thumbnail.url/image.jpg") ); - when(dummyEntity.getItemStock()).thenReturn(new ItemStock(10)); - // when var response = pointItemService.getPointItemInfo(null, itemId); @@ -181,8 +176,6 @@ class PointItemServiceTest { when(dummyEntity.getItemMedia()).thenReturn( new ItemMedia("https://thumbnail.url/image.jpg") ); - when(dummyEntity.getItemStock()).thenReturn(new ItemStock(10)); - // 포인트 계산 결과(record) UserPointCalculation calc = new UserPointCalculation( BigDecimal.valueOf(5000), @@ -209,8 +202,7 @@ private PointItemCreateCommand getCreateItemCommand() { new ItemCode("ITM-AA-001"), new ItemBasicInfo("맑은 뭉게 구름 ", "하늘에서 포근한 구름이 내려와 식물을 감싸요. 몽글몽글 기분 좋은 하루!"), new ItemMedia("https://thumbnail.url/image.jpg"), - new ItemPrice(BigDecimal.valueOf(1200)), - new ItemStock(10) + new ItemPrice(BigDecimal.valueOf(1200)) ); } @@ -219,8 +211,6 @@ private PointItemUpdateCommand getUpdateItemCommand() { new ItemCode("ITM-AA-001"), new ItemBasicInfo("행운의 네잎클로버 ", "행운의 네잎클로버가 식물을 감싸요. 뭔가 운이 좋을 것 같은 하루!"), new ItemMedia("https://thumbnail.url/image.jpg"), - new ItemPrice(BigDecimal.valueOf(600)), - new ItemStock(10) - ); + new ItemPrice(BigDecimal.valueOf(600))); } }