Skip to content

Commit

Permalink
fix bug in contactsServiceImpl class
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongyuanzhao000 committed Apr 16, 2020
1 parent 32686be commit 4cd7a24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Response findContactsById(UUID id, HttpHeaders headers) {
if (contacts != null) {
return new Response<>(1, success, contacts);
} else {
return new Response<>(0, "No contacts accorrding to contacts id", id);
return new Response<>(0, "No contacts according to contacts id", null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testFindContactsById2() {
UUID id = UUID.randomUUID();
Mockito.when(contactsRepository.findById(Mockito.any(UUID.class))).thenReturn(null);
Response result = contactsServiceImpl.findContactsById(id, headers);
Assert.assertEquals(new Response<>(0, "No contacts accorrding to contacts id", id), result);
Assert.assertEquals(new Response<>(0, "No contacts according to contacts id", null), result);
}

@Test
Expand Down Expand Up @@ -115,14 +115,13 @@ public void testDelete2() {
Assert.assertEquals(new Response<>(0, "Delete failed", contactsId), result);
}

//TODO: The method modify() has a bug to fix.
// @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 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() {
Expand Down

0 comments on commit 4cd7a24

Please sign in to comment.