### Question:
UsersUtil { public static boolean isExists(JCUser user) { if (user != null) { try { return (user.getUsername() != null); } catch (ObjectNotFoundException ex) { LOGGER.warn("User does not exist.", ex); return false; } } return false; }  static boolean isExists(JCUser user);  }### Answer:
@Test public void testIsExists() { JCUser user = new JCUser("user1", "user1@mail.org", "pass1"); assertTrue(UsersUtil.isExists(user)); }
@Test public void testIfUserNull() { assertFalse(UsersUtil.isExists(null)); }
@Test public void testIfObjectNotFound() { JCUser user = mock(JCUser.class); when(user.getUsername()).thenThrow(new ObjectNotFoundException(0L, JCUser.class.getName())); assertFalse(UsersUtil.isExists(user)); }