@Test public void executeWithNonExistingItem() { when(persistenceContext.find(PlanningTaskImpl.class, TASK_ID)).thenReturn(null); command.execute(taskContext); verify(persistenceContext, never()).remove(any()); }
@Override public Object execute(Context context) { super.execute(context); PlanningTaskImpl instance = persistenceContext.find(PlanningTaskImpl.class, getItemId()); if (instance != null) { persistenceContext.remove(instance); } return null; }
DeletePlanningItemCommand extends PlanningCommand { @Override public Object execute(Context context) { super.execute(context); PlanningTaskImpl instance = persistenceContext.find(PlanningTaskImpl.class, getItemId()); if (instance != null) { persistenceContext.remove(instance); } return null; } }
DeletePlanningItemCommand extends PlanningCommand { @Override public Object execute(Context context) { super.execute(context); PlanningTaskImpl instance = persistenceContext.find(PlanningTaskImpl.class, getItemId()); if (instance != null) { persistenceContext.remove(instance); } return null; } DeletePlanningItemCommand(long itemId); }
DeletePlanningItemCommand extends PlanningCommand { @Override public Object execute(Context context) { super.execute(context); PlanningTaskImpl instance = persistenceContext.find(PlanningTaskImpl.class, getItemId()); if (instance != null) { persistenceContext.remove(instance); } return null; } DeletePlanningItemCommand(long itemId); long getItemId(); @Override Object execute(Context context); }
DeletePlanningItemCommand extends PlanningCommand { @Override public Object execute(Context context) { super.execute(context); PlanningTaskImpl instance = persistenceContext.find(PlanningTaskImpl.class, getItemId()); if (instance != null) { persistenceContext.remove(instance); } return null; } DeletePlanningItemCommand(long itemId); long getItemId(); @Override Object execute(Context context);  }