### Question:
ContactsServiceImpl implements ContactsService { @Override public Response createContacts(Contacts contacts, HttpHeaders headers) { Contacts contactsTemp = contactsRepository.findById(contacts.getId()); if (contactsTemp != null) { ContactsServiceImpl.LOGGER.info("[Contacts Service][Init Contacts] Already Exists Id: {}", contacts.getId()); return new Response<>(0, "Already Exists", contactsTemp); } else { contactsRepository.save(contacts); return new Response<>(1, "Create Success", null); } }  @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 testCreateContacts1() { Contacts contacts = new Contacts(); Mockito.when(contactsRepository.findById(Mockito.any(UUID.class))).thenReturn(contacts); Response result = contactsServiceImpl.createContacts(contacts, headers); Assert.assertEquals(new Response<>(0, "Already Exists", contacts), result); }
@Test public void testCreateContacts2() { Contacts contacts = new Contacts(); Mockito.when(contactsRepository.findById(Mockito.any(UUID.class))).thenReturn(null); Mockito.when(contactsRepository.save(Mockito.any(Contacts.class))).thenReturn(null); Response result = contactsServiceImpl.createContacts(contacts, headers); Assert.assertEquals(new Response<>(1, "Create Success", null), result); }