generated from pricelees/issue-pr-template
feat: ReservationSearchSpecification 내 예약 상태를 지정하는 조건 추가 및 테스트
This commit is contained in:
parent
9be9b4919c
commit
cf61c0de43
@ -33,6 +33,10 @@ class ReservationSearchSpecification(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
fun status(vararg statuses: ReservationStatus) = andIfNotNull { root, _, cb ->
|
||||||
|
root.get<ReservationStatus>("status").`in`(statuses.toList())
|
||||||
|
}
|
||||||
|
|
||||||
fun confirmed(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
|
fun confirmed(): ReservationSearchSpecification = andIfNotNull { root, _, cb ->
|
||||||
cb.or(
|
cb.or(
|
||||||
cb.equal(
|
cb.equal(
|
||||||
|
|||||||
@ -81,6 +81,21 @@ class ReservationSearchSpecificationTest(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"여러 상태를 입력받아 같은 상태안 예약을 조회한다." {
|
||||||
|
val spec = ReservationSearchSpecification()
|
||||||
|
.status(
|
||||||
|
ReservationStatus.CONFIRMED,
|
||||||
|
ReservationStatus.CONFIRMED_PAYMENT_REQUIRED,
|
||||||
|
ReservationStatus.WAITING
|
||||||
|
).build()
|
||||||
|
|
||||||
|
val results: List<ReservationEntity> = reservationRepository.findAll(spec)
|
||||||
|
|
||||||
|
assertSoftly(results) {
|
||||||
|
this shouldHaveSize reservationRepository.findAll().size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
"확정 상태인 예약을 조회한다" {
|
"확정 상태인 예약을 조회한다" {
|
||||||
val spec = ReservationSearchSpecification()
|
val spec = ReservationSearchSpecification()
|
||||||
.confirmed()
|
.confirmed()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user