### Question:
DeleteContextEntryCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                     VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { context.getContextEntry().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, oldContextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteContextEntryCommand(final Context context,
                                     final GridData uiModel,
                                     final int uiRowIndex,
                                     final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }### Answer:
@Test public void testGraphCommandAllow() { makeCommand(0); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.allow(gce)); }
@Test public void testGraphCommandExecute() { makeCommand(0); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(0, context.getContextEntry().size()); }
@Test public void testGraphCommandExecuteMultipleRows() { addContextEntries(3); final ContextEntry firstEntry = context.getContextEntry().get(0); final ContextEntry lastEntry = context.getContextEntry().get(2); makeCommand(1); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); Assertions.assertThat(context.getContextEntry()).containsExactly(firstEntry, lastEntry); }
@Test public void testGraphCommandUndo() { makeCommand(0); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(1, context.getContextEntry().size()); }
@Test public void testGraphCommandUndoMultipleRows() { addContextEntries(3); final ContextEntry firstEntry = context.getContextEntry().get(0); final ContextEntry originalEntry = context.getContextEntry().get(1); final ContextEntry lastEntry = context.getContextEntry().get(2); makeCommand(1); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); Assertions.assertThat(context.getContextEntry()).containsExactly(firstEntry, originalEntry, lastEntry); }