Skip to content

Commit

Permalink
test: 주문 상태 요리 완료 test 코드 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
choi5798 committed Sep 15, 2023
1 parent cae350f commit db920c9
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Optional;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;

@ExtendWith(MockitoExtension.class)
Expand Down Expand Up @@ -102,4 +103,18 @@ void successRejectOrder() {
assertThat(rejectedOrder).hasFieldOrPropertyWithValue("rejectReason", "재고 소진");
}

@Test
@DisplayName("주문 상태를 요리 완료로 설정하는데 성공한다")
void successGetReadyOrder() {
// given
given(orderRepository.findById(any(Long.class))).willReturn(Optional.ofNullable(order));
given(orderRepository.save(any(Order.class))).willReturn(order);

// when
Order readyOrder = orderService.finishCooking(1L);

// then
assertThat(readyOrder).hasFieldOrPropertyWithValue("status", OrderStatus.READY);
}

}

0 comments on commit db920c9

Please sign in to comment.