Skip to content

Instantly share code, notes, and snippets.

@cosbor11
Created April 7, 2016 03:49
Show Gist options
  • Select an option

  • Save cosbor11/fc5f5b479d22b8684f729be380af6214 to your computer and use it in GitHub Desktop.

Select an option

Save cosbor11/fc5f5b479d22b8684f729be380af6214 to your computer and use it in GitHub Desktop.
Manipulate a BeverageEffect in order to observe its lifecycle behavior
// Define a beverage effect
BeverageEffects effectsOfWater = new BeverageEffects(Beverage.WATER);
// Observe the behavior of the pre insert listener
manager.saveEntity(effectsOfWater);
assertTrue("After saving the behavior entity, the effects should be thirsty", effectsOfWater.getDescription().equals(Beverage.WATER.getPreConsumption()));
// Observe the behavior of the pre update listener
manager.saveEntity(effectsOfWater);
assertTrue("After updating the behavior entity, the effects should be satisfied", effectsOfWater.getDescription().equals(Beverage.WATER.getDuringConsumption()));
// Observe the behavior of the pre delete listener
manager.deleteEntity(effectsOfWater);
assertTrue("Before deleting the behavior entity, the effects should be, I gotta pee", effectsOfWater.getDescription().equals(Beverage.WATER.getAfterConsumption()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment