Conversation
|
Closes: #9 |
|
Closes: #9 |
| @Convert(converter = StringListConverter::class) | ||
| @Column(name = "item_options") | ||
| val options: List<String> = listOf(), |
There was a problem hiding this comment.
options 에 어떤게 들어가는 거에용?
요로케 String 으로 저장했을 때에 어떤 장단점이 있을지 설명 부탁드리겠습니다~
| @Test | ||
| fun `CREATED 또는 PAID 상태이면 CANCELLED로 정상 변경된다`() { |
There was a problem hiding this comment.
동일한 시나리오에 상태 검증이 2개 이상일 때, @ParameterizedTest 와 @CsvSource 조합도 사용해보시면 좋을 것 같아요~
@ParameterizedTest(name = "주문 상태가 {0} 이면, CANCELLED 로 정상변경 된다.")
@CsvSource("CREATED", "PAID")
| @Test | ||
| fun `아이템 가격과 수량을 곱한 총액을 반환한다`() { | ||
| // given | ||
| val item = OrderFixtures.anOrderItem(price = 15000) | ||
| val orderLine = OrderFixtures.anOrderLine(item = item, quantity = 3) | ||
|
|
||
| // when | ||
| val totalPrice = orderLine.getTotalPrice() | ||
|
|
||
| // then | ||
| assertThat(totalPrice).isEqualTo(45000) | ||
| } |
There was a problem hiding this comment.
NIT.
이건 아주 소소한데, price 랑 quantity 를 변수로 선언하고,
isEqaulTo 에서 expected 를 price * qunatity 로 의도를 드러내는게 쪼꼼 더 좋지 않을까 생각해봤어요!
|
|
||
| import org.mockito.Mockito.mock | ||
|
|
||
| object OrderFixtures { |
There was a problem hiding this comment.
👍👍👍👍
이미 아실 수도 있지만, 조금 더 객체 생성이 복잡해지면 kotest 의 Fixture 를 사용해도 좋을 것 같아요
| import org.junit.jupiter.api.Nested | ||
| import org.junit.jupiter.api.Test | ||
|
|
||
| class OrderTest { |
There was a problem hiding this comment.
꼼꼼한 테스트가 객체 설계의 의도를 더 잘 드러내는 것 같습니다 👍👍
| import jakarta.persistence.Table | ||
|
|
||
| @Entity | ||
| @Table(name = "orders") |
There was a problem hiding this comment.
product, seller ...
table name 이 단수형이었었는데 orders 만 별도로 복수형으로 하신 이유가 궁금해욥
|



Closes #9