Skip to content

Commit

Permalink
test: save 수정하면서 깨진 테스트 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
EunjiShin committed Jul 18, 2024
1 parent 0e9926c commit c915727
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicLong;

import org.depromeet.spot.common.exception.seat.SeatException.SeatNotFoundException;
import org.depromeet.spot.domain.seat.Seat;
import org.depromeet.spot.usecase.port.out.seat.SeatRepository;

Expand All @@ -19,6 +21,15 @@ public void saveAll(List<Seat> seats) {
seats.forEach(this::save);
}

@Override
public Seat findById(Long seatId) {
return getById(seatId).orElseThrow(SeatNotFoundException::new);
}

private Optional<Seat> getById(Long id) {
return data.stream().filter(seat -> seat.getId().equals(id)).findAny();
}

private Seat save(Seat seat) {
if (seat.getId() == null || seat.getId() == 0) {
Seat newSeat =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void setUp() {
for (int i = 0; i < 20; i++) {
Review review =
Review.builder()
.id((long) i)
.id((long) i + 1)
.stadiumId(1L)
.blockId(1L)
.rowId(1L)
Expand Down

0 comments on commit c915727

Please sign in to comment.