Last active
March 6, 2020 02:22
-
-
Save SDiamante13/f2224ec7300e524a835fd8bc7b747ad1 to your computer and use it in GitHub Desktop.
An example on how to use BDD syntax to verify a method is called
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() { | |
| // Given | |
| Customer customer = new Customer(123, "Sam"); | |
| // When | |
| Customer result = customerService.saveCustomer(customer); | |
| // Then | |
| then(mockCustomerRepository) | |
| .should(times(1)) | |
| .save(customer) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment