@Test public void testRemoveUnfamiliarContact() { UserContact userContact = new UserContact(CONTACT, createUserContactType()); userContact.setId(1L); user.addContact(userContact); userContactsService.removeContact(2L); assertEquals(user.getUserContacts().size(), 1); }
@Test public void testRemoveContact() { UserContact userContact = new UserContact(CONTACT, createUserContactType()); userContact.setId(1L); user.addContact(userContact); when(userContactsDao.getContactById(1L)).thenReturn(userContact); userContactsService.removeContact(1L); assertEquals(user.getUserContacts().size(), 0); }