Skip to content

[#9] 주문 도메인 모델 구현#12

Merged
nilgil merged 11 commits intodevelopfrom
feat/9
Jul 22, 2025
Merged

[#9] 주문 도메인 모델 구현#12
nilgil merged 11 commits intodevelopfrom
feat/9

Conversation

@nilgil
Copy link
Collaborator

@nilgil nilgil commented Jul 12, 2025

Closes #9

  • 주문 관련 도메인 엔티티 작성
  • 주문 도메인 다이어그램 문서 추가

@nilgil nilgil requested a review from f-lab-seb July 12, 2025 03:17
@nilgil nilgil linked an issue Jul 12, 2025 that may be closed by this pull request
@nilgil nilgil self-assigned this Jul 12, 2025
@nilgil nilgil added the enhancement New feature or request label Jul 12, 2025
@github-actions
Copy link

Closes: #9

@nilgil nilgil changed the title feat/9 [#9] 주문 도메인 엔티티 작성 Jul 12, 2025
@github-actions
Copy link

Closes: #9

@nilgil nilgil changed the title [#9] 주문 도메인 엔티티 작성 [#9] Order 도메인 모델 구현 Jul 12, 2025
@nilgil nilgil changed the title [#9] Order 도메인 모델 구현 [#9] 주문 도메인 모델 구현 Jul 12, 2025
Copy link
Collaborator

@f-lab-seb f-lab-seb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다!!

Comment on lines +12 to +14
@Convert(converter = StringListConverter::class)
@Column(name = "item_options")
val options: List<String> = listOf(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

options 에 어떤게 들어가는 거에용?
요로케 String 으로 저장했을 때에 어떤 장단점이 있을지 설명 부탁드리겠습니다~

Comment on lines +68 to +69
@Test
fun `CREATED 또는 PAID 상태이면 CANCELLED로 정상 변경된다`() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

동일한 시나리오에 상태 검증이 2개 이상일 때, @ParameterizedTest@CsvSource 조합도 사용해보시면 좋을 것 같아요~

@ParameterizedTest(name = "주문 상태가 {0} 이면, CANCELLED 로 정상변경 된다.")
@CsvSource("CREATED", "PAID")

Comment on lines +40 to +51
@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)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT.
이건 아주 소소한데, price 랑 quantity 를 변수로 선언하고,
isEqaulTo 에서 expected 를 price * qunatity 로 의도를 드러내는게 쪼꼼 더 좋지 않을까 생각해봤어요!


import org.mockito.Mockito.mock

object OrderFixtures {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍👍
이미 아실 수도 있지만, 조금 더 객체 생성이 복잡해지면 kotest 의 Fixture 를 사용해도 좋을 것 같아요

import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test

class OrderTest {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꼼꼼한 테스트가 객체 설계의 의도를 더 잘 드러내는 것 같습니다 👍👍

import jakarta.persistence.Table

@Entity
@Table(name = "orders")
Copy link
Collaborator

@f-lab-seb f-lab-seb Jul 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

product, seller ...
table name 이 단수형이었었는데 orders 만 별도로 복수형으로 하신 이유가 궁금해욥

@sonarqubecloud
Copy link

@nilgil nilgil merged commit 04ae543 into develop Jul 22, 2025
2 checks passed
@nilgil nilgil deleted the feat/9 branch July 22, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

주문 도메인 모델 구현

2 participants