### Question:
UserModelHooks { public boolean preventSelfDeletion(final DataDefinition userDD, final Entity user) { if (ObjectUtils.equals(securityService.getCurrentUserId(), user.getId())) { user.addGlobalError(SELF_DELETION_ERROR); return false; } return true; }  boolean preventSelfDeletion(final DataDefinition userDD, final Entity user); void setDefaultNames(final DataDefinition userDD, final Entity user);  }### Answer:
@Test public final void shouldAllowToDeleteUserIfCurrentUserIdIsOtherThanInDeletingOne() { stubCurrentUserId(1L); stubUserEntityId(9999L); boolean canDelete = userModelHooks.preventSelfDeletion(userDD, user); assertTrue(canDelete); }
@Test public final void shouldAllowToDeleteUserIfCurrentUserIdIsNull() { stubCurrentUserId(null); stubUserEntityId(9999L); boolean canDelete = userModelHooks.preventSelfDeletion(userDD, user); assertTrue(canDelete); }
@Test public final void shouldDenyUserDeletionIfCurrentUserIdIsTheSameAsIdInDeletingOne() { Long id = 1L; stubCurrentUserId(id); stubUserEntityId(id); boolean canDelete = userModelHooks.preventSelfDeletion(userDD, user); assertFalse(canDelete); }