verify(contact, never()).changeName("Double New Name");
}
@Test
public void testHandleChangeNameContactCommand_happypath() {
ChangeContactNameCommand command = new ChangeContactNameCommand();
command.setContactId(UUID.randomUUID().toString());
command.setContactNewName("Good New Name");
ContactEntry mockContactEntry = mock(ContactEntry.class);
when(mockContactNameRepository.claimContactName("Good New Name"))
.thenReturn(true);
when(mockRepository.load(isA(String.class)))
.thenReturn(mockContact);
when(mockContactRepository.loadContactDetails(command.getContactId()))
.thenReturn(mockContactEntry);
when(mockContactEntry.getName()).thenReturn("Good Old Name");
ArgumentCaptor<UnitOfWorkListener> unitOfWorkListenerArgumentCaptor =
ArgumentCaptor.forClass(UnitOfWorkListener.class);