We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
単体テストにおいて、 リポジトリに引数が正しく渡されているかを検証するケースが不足している箇所がある。 該当箇所を調査のうえ、不足しているものについてはケースを追加する。
when(this.orderRepository.add(any())).thenReturn(order);
@Test void testCheckout_正常系_注文リポジトリのAddを1回呼出す() throws Exception { // Arrange String buyerId = UUID.randomUUID().toString(); Basket basket = new Basket(buyerId); basket.addItem(10L, BigDecimal.valueOf(100_000_000), 1); ShipTo shipToAddress = createDefaultShipTo(); List<CatalogItem> catalogItems = List.of(createCatalogItem(10L)); Order order = new Order(buyerId, shipToAddress, createDefaultOrderItems()); when(this.basketRepository.findByBuyerId(buyerId)).thenReturn(Optional.of(basket)); when(this.catalogRepository.findByCatalogItemIdIn(List.of(10L))).thenReturn(catalogItems); when(this.orderRepository.add(any())).thenReturn(order); // Act service.checkout(buyerId, shipToAddress); // Assert verify(this.orderRepository, times(1)).add(any()); verify(this.basketRepository, times(1)).findByBuyerId(buyerId); verify(this.basketRepository, times(1)).remove(basket); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
概要
単体テストにおいて、
リポジトリに引数が正しく渡されているかを検証するケースが不足している箇所がある。
該当箇所を調査のうえ、不足しているものについてはケースを追加する。
詳細 / 機能詳細(オプション)
when(this.orderRepository.add(any())).thenReturn(order);
を用いているため、引数の妥当性を検証できていない。
完了条件
The text was updated successfully, but these errors were encountered: