### Question:
UserModelHooks { public void setDefaultNames(final DataDefinition userDD, final Entity user) { replaceByUserNameIfBlank(user, UserFields.FIRST_NAME); replaceByUserNameIfBlank(user, UserFields.LAST_NAME); }  boolean preventSelfDeletion(final DataDefinition userDD, final Entity user); void setDefaultNames(final DataDefinition userDD, final Entity user);  }### Answer:
@Test public final void shouldNotReplaceAnyNameWithUserName() { stubUserNames(TEST_USER_NAME, "someFirstName", "someLastName"); userModelHooks.setDefaultNames(userDD, user); verify(user, never()).setField(UserFields.FIRST_NAME, TEST_USER_NAME); verify(user, never()).setField(UserFields.LAST_NAME, TEST_USER_NAME); }
@Test public final void shouldReplaceBlankLastNameWithUserName() { stubUserNames(TEST_USER_NAME, "someFirstName", null); userModelHooks.setDefaultNames(userDD, user); verify(user, never()).setField(UserFields.FIRST_NAME, TEST_USER_NAME); verify(user).setField(UserFields.LAST_NAME, TEST_USER_NAME); }
@Test public final void shouldReplaceNullLastNameWithUserName() { stubUserNames(TEST_USER_NAME, "someFirstName", null); userModelHooks.setDefaultNames(userDD, user); verify(user, never()).setField(UserFields.FIRST_NAME, TEST_USER_NAME); verify(user).setField(UserFields.LAST_NAME, TEST_USER_NAME); }
@Test public final void shouldReplaceBlankFirstNameWithUserName() { stubUserNames(TEST_USER_NAME, " ", "someLastName"); userModelHooks.setDefaultNames(userDD, user); verify(user).setField(UserFields.FIRST_NAME, TEST_USER_NAME); verify(user, never()).setField(UserFields.LAST_NAME, TEST_USER_NAME); }
@Test public final void shouldReplaceNullFirstNameWithUserName() { stubUserNames(TEST_USER_NAME, null, "someLastName"); userModelHooks.setDefaultNames(userDD, user); verify(user).setField(UserFields.FIRST_NAME, TEST_USER_NAME); verify(user, never()).setField(UserFields.LAST_NAME, TEST_USER_NAME); }
@Test public final void shouldReplaceBothBlankFirstAndLastNameWithUserName() { stubUserNames(TEST_USER_NAME, " ", " "); userModelHooks.setDefaultNames(userDD, user); verify(user).setField(UserFields.FIRST_NAME, TEST_USER_NAME); verify(user).setField(UserFields.LAST_NAME, TEST_USER_NAME); }
@Test public final void shouldReplaceBothNullFirstAndLastNameWithUserName() { stubUserNames(TEST_USER_NAME, null, null); userModelHooks.setDefaultNames(userDD, user); verify(user).setField(UserFields.FIRST_NAME, TEST_USER_NAME); verify(user).setField(UserFields.LAST_NAME, TEST_USER_NAME); }