Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

We'd like to have a consistent and safe way for study designers (almost always the implementers, so people with the DEVELOPER role) to delete and remove things as they set up a study. Often our delete APIs remove things from the database, and so those calls are only accessible to administrators for test clean-up.

...

  • If item is already logically deleted, throw an EntityNotFoundException (deletingLogicallyDeletedAppleThrows)
  • If item is not marked deleted, mark it as deleted (logicallyDeletingAppleWorks)

...

  • If item is not in database, throw an EntityNotFoundException (physicallyDeletingMissingAppleThrows)
  • If item is in database but logically deleted, this should physically delete the item (physicallyDeletingLogicallyDeletedAppleWorks)

...

NameWhat we should test
getAppleIncludesLogicallyDeletedThe get apple call returns logically deleted apples
getApplesIncludes/ExcludesLogicallyDeletedThe apple collection calls include or exclude logically deleted apples based on the flag
createAppleCannotBeDeletedCreating an apple with deleted=true just creates the apple with deleted=false
updateLogicallyDeletedAppleThrowsCannot update if saved and updated apple are both deleted=true
updateCanUndeleteApplesaved apple deleted=true, updated apple deleted=false works
updateCanDeleteApplesaved apple deleted=false, updated apple deleted=true works (no reason to prevent it)
logicallyDeletingLogicallyDeletedAppleThrowsdeleteLogicallyDeletedAppleThrowsCannot delete an apple that is already deleted
deleteAppleCan logically delete an apple
deleteAppleMissingAppleThrowsTrying to logically delete a logically deleted apple throws
deleteApplePermanentlyCan permanently delete an apple
deletePermanentlyLogicallyDeletedAppleCan physically delete an apple that is logically deleted (rather than getting a 404)
deletePermanentlyMissingAppleThrows

...