### Question:
SavePlanningItemCommand extends PlanningCommand { @Override public Object execute(Context context) { super.execute(context); saveOrUpdatePlanningTask(planningItem); return null; } SavePlanningItemCommand(PlanningItem planningItem); @Override Object execute(Context context);  }### Answer:
@Test public void executeWithPlanningTaskExisting() { PlanningTaskImpl planningTask = mock(PlanningTaskImpl.class); when(persistenceContext.find(PlanningTaskImpl.class, TASK_ID)).thenReturn(planningTask); command.execute(taskContext); verifyPlanningTaskMerged(planningTask); }
@Test public void executeWithPlanningTaskNotExisting() { when(persistenceContext.find(PlanningTaskImpl.class, TASK_ID)).thenReturn(null); command.execute(taskContext); verify(persistenceContext).persist(planningTaskCaptor.capture()); verifyPlanningTaskPersisted(planningTaskCaptor.getValue()); }