Skip to content

Instantly share code, notes, and snippets.

@SDiamante13
Last active March 6, 2020 02:22
Show Gist options
  • Select an option

  • Save SDiamante13/f2224ec7300e524a835fd8bc7b747ad1 to your computer and use it in GitHub Desktop.

Select an option

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
@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