Skip to content

Commit

Permalink
refactor: rename functions changing status of reservation
Browse files Browse the repository at this point in the history
  • Loading branch information
woowabrie committed Oct 9, 2023
1 parent 9c4e58b commit eeec842
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class MailReservationService(
)

reservations.forEach { mailReservation ->
mailReservation.process()
mailReservation.send()
mailService.sendMailsByBcc(MailData(mailReservation.mailMessage), emptyMap()) {
mailReservation.complete()
mailReservation.finish()
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/apply/domain/mail/MailReservation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class MailReservation(
validateTime(reservationTime)
}

fun process() {
fun send() {
status = MailReservationStatus.SENDING
}

fun complete() {
fun finish() {
status = MailReservationStatus.FINISHED
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MailMessageIntegrationTest(

Given("취소하고 싶은 예약 메일이 처리중인 경우") {
val mailMessage = mailMessageRepository.save(createReservationMailMessage())
mailMessage.reservation()?.process()
mailMessage.reservation()?.send()

When("메일 예약을 취소하면") {
Then("에러가 발생하고 메일 메시지와 예약은 남아있다") {
Expand All @@ -73,7 +73,7 @@ class MailMessageIntegrationTest(

Given("취소하고 싶은 예약 메일이 발송 완료된 경우") {
val mailMessage = mailMessageRepository.save(createReservationMailMessage())
mailMessage.reservation()?.complete()
mailMessage.reservation()?.finish()

When("메일 예약을 취소하면") {
Then("에러가 발생하고 메일 메시지와 예약은 남아있다") {
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/apply/domain/mail/MailReservationTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ class MailReservationTest : StringSpec({
"예약 메일 전송을 시작한다" {
val mailReservation = createMailReservation()

mailReservation.process()
mailReservation.send()
mailReservation.status shouldBe MailReservationStatus.SENDING
}

"예약 메일 전송을 완료한다" {
val mailReservation = createMailReservation()

mailReservation.complete()
mailReservation.finish()
mailReservation.status shouldBe MailReservationStatus.FINISHED
}
})

0 comments on commit eeec842

Please sign in to comment.