Skip to content

Instantly share code, notes, and snippets.

@atesibrahim
Created June 29, 2022 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atesibrahim/61c44c44e83ac56dcb5c126448f298e1 to your computer and use it in GitHub Desktop.
Save atesibrahim/61c44c44e83ac56dcb5c126448f298e1 to your computer and use it in GitHub Desktop.
@Test
public void it_should_save_number_when_flag_is_true() {
//Given
ArgumentCaptor<Product> productArgumentCaptor = ArgumentCaptor.forClass(Product.class);
Product product = Product.builder().isFlag(true).build();
//When
productService.save(product);
//Then
verify(productRepository).save(productArgumentCaptor.capture());
final Product capturedProduct = productArgumentCaptor.getValue();
assertThat(capturedProduct.getIsFlag()).isTrue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment