ProfileManager { public void update(Profile profile) throws NotFoundException, ServerException { requireNonNull(profile, "Required non-null profile"); profileDao.update(new ProfileImpl(profile)); }  Profile getById(String userId); void create(Profile profile); void update(Profile profile); void remove(String userId);  }
@Test public void shouldUpdateProfile() throws Exception { final ProfileImpl profile = new ProfileImpl("user123"); profileManager.update(profile); final ArgumentCaptor<ProfileImpl> captor = ArgumentCaptor.forClass(ProfileImpl.class); verify(profileDao).update(captor.capture()); assertEquals(captor.getValue(), profile); }
@Test(expectedExceptions = NullPointerException.class) public void shouldThrowNpeWhenUpdatingNull() throws Exception { profileManager.update(null); }