### Question:
ContactsServiceImpl implements ContactsService { @Override public Response delete(UUID contactsId, HttpHeaders headers) { contactsRepository.deleteById(contactsId); Contacts contacts = contactsRepository.findById(contactsId); if (contacts == null) { ContactsServiceImpl.LOGGER.info("[Contacts-Add&Delete-Service][DeleteContacts] Success."); return new Response<>(1, "Delete success", contactsId); } else { ContactsServiceImpl.LOGGER.info("[Contacts-Add&Delete-Service][DeleteContacts] Fail.Reason not clear."); return new Response<>(0, "Delete failed", contactsId); } }  @Override Response findContactsById(UUID id, HttpHeaders headers); @Override Response findContactsByAccountId(UUID accountId, HttpHeaders headers); @Override Response createContacts(Contacts contacts, HttpHeaders headers); @Override Response create(Contacts addContacts, HttpHeaders headers); @Override Response delete(UUID contactsId, HttpHeaders headers); @Override Response modify(Contacts contacts, HttpHeaders headers); @Override Response getAllContacts(HttpHeaders headers);  }### Answer:
@Test public void testDelete1() { UUID contactsId = UUID.randomUUID(); Mockito.doNothing().doThrow(new RuntimeException()).when(contactsRepository).deleteById(Mockito.any(UUID.class)); Mockito.when(contactsRepository.findById(Mockito.any(UUID.class))).thenReturn(null); Response result = contactsServiceImpl.delete(contactsId, headers); Assert.assertEquals(new Response<>(1, "Delete success", contactsId), result); }
@Test public void testDelete2() { UUID contactsId = UUID.randomUUID(); Contacts contacts = new Contacts(); Mockito.doNothing().doThrow(new RuntimeException()).when(contactsRepository).deleteById(Mockito.any(UUID.class)); Mockito.when(contactsRepository.findById(Mockito.any(UUID.class))).thenReturn(contacts); Response result = contactsServiceImpl.delete(contactsId, headers); Assert.assertEquals(new Response<>(0, "Delete failed", contactsId), result); }