@Test public final void shouldDenyUserDeletionIfCurrentUserIdIsTheSameAsIdInDeletingOne() { Long id = 1L; stubCurrentUserId(id); stubUserEntityId(id); boolean canDelete = userModelHooks.preventSelfDeletion(userDD, user); assertFalse(canDelete); }
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; }
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; } }
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; }  }
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); }
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);  }