### Question:
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);  }### Answer:
@Test public void executeWithExistingItem() { PlanningTaskImpl planningTask = mock(PlanningTaskImpl.class); when(persistenceContext.find(PlanningTaskImpl.class, TASK_ID)).thenReturn(planningTask); command.execute(taskContext); verify(persistenceContext).remove(planningTask); }
@Test public void executeWithNonExistingItem() { when(persistenceContext.find(PlanningTaskImpl.class, TASK_ID)).thenReturn(null); command.execute(taskContext); verify(persistenceContext, never()).remove(any()); }