Skip to content

Commit

Permalink
test: bookingQueueRepository mockBean 제거한거 롤백
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanna committed Jan 11, 2024
1 parent 79ab14a commit 2a62c2b
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.pgms.apibooking.domain.booking.dto.request.BookingCreateRequest;
import com.pgms.apibooking.domain.booking.dto.response.BookingCreateResponse;
import com.pgms.apibooking.domain.booking.service.BookingService;
import com.pgms.apibooking.domain.bookingqueue.repository.BookingQueueRepository;
import com.pgms.apibooking.domain.payment.dto.request.RefundAccountRequest;
import com.pgms.apibooking.domain.seat.service.SeatLockService;
import com.pgms.apibooking.factory.BookingFactory;
Expand Down Expand Up @@ -90,6 +91,9 @@ class BookingServiceTest {
@Autowired
private MemberRepository memberRepository;

@MockBean
private BookingQueueRepository bookingQueueRepository;

@MockBean
private SeatLockService seatLockService;

Expand Down Expand Up @@ -157,8 +161,8 @@ void setup() {
Optional.empty()
);

given(seatLockService.getSelectorId(seat1.getId())).willReturn(member.getId());
given(seatLockService.getSelectorId(seat2.getId())).willReturn(member.getId());
given(seatLockService.getSelectorId(any(Long.class))).willReturn(member.getId());
doNothing().when(bookingQueueRepository).remove(any(Long.class), any(String.class));

// when
BookingCreateResponse response = bookingService.createBooking(request, member.getId(), SESSION_ID);
Expand Down Expand Up @@ -291,6 +295,8 @@ void setup() {
Optional.empty()
);

given(seatLockService.getSelectorId(seat.getId())).willReturn(member.getId());

// when & then
assertThatThrownBy(() -> bookingService.createBooking(request, member.getId(), SESSION_ID))
.isInstanceOf(BookingException.class)
Expand Down Expand Up @@ -395,6 +401,8 @@ void setup() {
Optional.empty()
);

given(seatLockService.getSelectorId(seat.getId())).willReturn(member.getId());

// when & then
assertThatThrownBy(() -> bookingService.createBooking(request, member.getId(), SESSION_ID))
.isInstanceOf(BookingException.class)
Expand Down

0 comments on commit 2a62c2b

Please sign in to comment.