### Question:
ContactsServiceImpl implements ContactsService { @Override public Response modify(Contacts contacts, HttpHeaders headers) { Response oldContactResponse = findContactsById(contacts.getId(), headers); LOGGER.info(oldContactResponse.toString()); Contacts oldContacts = (Contacts) oldContactResponse.getData(); if (oldContacts == null) { ContactsServiceImpl.LOGGER.info("[Contacts-Modify-Service][ModifyContacts] Fail.Contacts not found."); return new Response<>(0, "Contacts not found", null); } else { oldContacts.setName(contacts.getName()); oldContacts.setDocumentType(contacts.getDocumentType()); oldContacts.setDocumentNumber(contacts.getDocumentNumber()); oldContacts.setPhoneNumber(contacts.getPhoneNumber()); contactsRepository.save(oldContacts); ContactsServiceImpl.LOGGER.info("[Contacts-Modify-Service][ModifyContacts] Success."); return new Response<>(1, "Modify success", oldContacts); } }  @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 testModify1() { Contacts contacts = new Contacts(UUID.randomUUID(), UUID.randomUUID(), "name", 1, "12", "10001"); Mockito.when(contactsRepository.findById(Mockito.any(UUID.class))).thenReturn(null); Response result = contactsServiceImpl.modify(contacts, headers); Assert.assertEquals(new Response<>(0, "Contacts not found", null), result); }
@Test public void testModify2() { Contacts contacts = new Contacts(UUID.randomUUID(), UUID.randomUUID(), "name", 1, "12", "10001"); Mockito.when(contactsRepository.findById(Mockito.any(UUID.class))).thenReturn(contacts); Mockito.when(contactsRepository.save(Mockito.any(Contacts.class))).thenReturn(null); Response result = contactsServiceImpl.modify(contacts, headers); Assert.assertEquals(new Response<>(1, "Modify success", contacts), result); }