Skip to content

Commit

Permalink
[fix] 주문 가격 타입을 long 으로 변경하여 컴파일 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
june-777 committed Aug 17, 2024
1 parent 44b87bc commit 203ee11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main/java/camp/woowak/lab/order/domain/vo/OrderItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
@Embeddable
public class OrderItem {
private Long menuId;
private int price;
private long price;
private int quantity;
private int totalPrice;
private long totalPrice;

protected OrderItem() {
}

public OrderItem(Long menuId, int price, int quantity) {
public OrderItem(Long menuId, long price, int quantity) {
this.menuId = menuId;
this.price = price;
this.quantity = quantity;
this.totalPrice = price * quantity;
}

public int getTotalPrice() {
public long getTotalPrice() {
return totalPrice;
}
}
6 changes: 3 additions & 3 deletions src/test/java/camp/woowak/lab/cart/domain/CartTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void setUp() {
store = createSavedStore(1L, vendor, "중화반점", minPrice,
LocalDateTime.now().minusMinutes(10).withSecond(0).withNano(0),
LocalDateTime.now().plusMinutes(10).withSecond(0).withNano(0));
menu = createSavedMenu(1L, store, new MenuCategory(store, "중식"), "짜장면", 9000);
menu = createSavedMenu(1L, store, new MenuCategory(store, "중식"), "짜장면", 9000L);
}

@Nested
Expand All @@ -70,7 +70,7 @@ void storeNotOpenExceptionTest() {
Store closedStore = createSavedStore(2L, vendor, "closed", minPrice,
LocalDateTime.now().minusMinutes(30).withSecond(0).withNano(0),
LocalDateTime.now().minusMinutes(10).withSecond(0).withNano(0));
Menu closedMenu = createSavedMenu(2L, closedStore, new MenuCategory(closedStore, "중식"), "짬뽕", 9000);
Menu closedMenu = createSavedMenu(2L, closedStore, new MenuCategory(closedStore, "중식"), "짬뽕", 9000L);

//when & then
assertThatThrownBy(() -> cart.addMenu(closedMenu))
Expand All @@ -87,7 +87,7 @@ void otherStoreMenuExceptionTest() {
Store otherStore = createSavedStore(2L, vendor, "otherStore", minPrice,
LocalDateTime.now().minusMinutes(30).withSecond(0).withNano(0),
LocalDateTime.now().plusMinutes(30).withSecond(0).withNano(0));
Menu otherStoreMenu = createSavedMenu(2L, otherStore, new MenuCategory(otherStore, "중식"), "짬뽕", 9000);
Menu otherStoreMenu = createSavedMenu(2L, otherStore, new MenuCategory(otherStore, "중식"), "짬뽕", 9000L);

//when & then
assertThatThrownBy(() -> cart.addMenu(otherStoreMenu))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ void withdraw_ValidPayAccount_WithdrawsPointsSuccessfully() {

OrderItem orderItem1 = mock(OrderItem.class);
OrderItem orderItem2 = mock(OrderItem.class);
when(orderItem1.getTotalPrice()).thenReturn(500);
when(orderItem2.getTotalPrice()).thenReturn(1500);
when(orderItem1.getTotalPrice()).thenReturn(500L);
when(orderItem2.getTotalPrice()).thenReturn(1500L);

List<OrderItem> orderItems = List.of(orderItem1, orderItem2);

Expand Down

0 comments on commit 203ee11

Please sign in to comment.