Created
October 24, 2020 22:56
-
-
Save yusufcakal/efc678b704478c7f9a5853ee924c6940 to your computer and use it in GitHub Desktop.
This file contains 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(expected = AddressUpdateException.class) | |
public void shouldNotUpdateAddressAndDoNotSendNotificationWhenAddressIdIsWrong() { | |
AddressUpdateRequest addressUpdateRequest = AddressUpdateRequestBuilder.anAddressUpdateRequestBuilder() | |
.id(1L) | |
.build(); | |
when(addressRepository.findById(1L)).thenReturn(Optional.empty()); | |
try { | |
addressService.update(addressUpdateRequest); | |
} catch (AddressUpdateException ex) { | |
verify(addressRepository).findById(1L); | |
throw ex; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment