Skip to content

Commit 795a778

Browse files
committed
<FIX> 메서드 체이닝 적용
1 parent 55a2797 commit 795a778

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/roomescape/reservation/presentation/ReservationController.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ public ResponseEntity<Reservation> createReservation(@Valid @RequestBody Reserva
3232

3333
@DeleteMapping("/reservations/{reservationId}")
3434
public ResponseEntity<Void> deleteReservation(@PathVariable Long reservationId) {
35-
Optional<Reservation> deleteReservation = reservationService.deleteReservation(reservationId);
36-
if (deleteReservation.isEmpty()) {
37-
throw new NotFoundReservationException();
38-
}
35+
Reservation deletedReservation = reservationService.deleteReservation(reservationId)
36+
.orElseThrow(NotFoundReservationException::new);
3937

4038
return ResponseEntity.noContent().build();
4139
}

0 commit comments

Comments
 (0)