### Question:
ContactsServiceImpl implements ContactsService { @Override public Response getAllContacts(HttpHeaders headers) { ArrayList<Contacts> contacts = contactsRepository.findAll(); if (contacts != null && !contacts.isEmpty()) { return new Response<>(1, success, contacts); } else { return new Response<>(0, "No content", 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 testGetAllContacts1() { ArrayList<Contacts> contacts = new ArrayList<>(); contacts.add(new Contacts()); Mockito.when(contactsRepository.findAll()).thenReturn(contacts); Response result = contactsServiceImpl.getAllContacts(headers); Assert.assertEquals(new Response<>(1, "Success", contacts), result); }
@Test public void testGetAllContacts2() { Mockito.when(contactsRepository.findAll()).thenReturn(null); Response result = contactsServiceImpl.getAllContacts(headers); Assert.assertEquals(new Response<>(0, "No content", null), result); }