Last active
March 12, 2020 14:20
-
-
Save SDiamante13/06b51ff0193927b54d06c655e75e9124 to your computer and use it in GitHub Desktop.
Example on how to use Mockito's verify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| public void saveCustomer_savesTheCustomerToTheDatabase() { | |
| // Arrange | |
| Customer customer = new Customer(123, "Sam"); | |
| // Act | |
| Customer result = customerService.saveCustomer(customer); | |
| // Assert | |
| verify(mockCustomerRepository, times(1)) | |
| .save(customer); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment