### Question:
DeleteListRowCommand 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) { list.getExpression().remove(uiRowIndex); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { list.getExpression().add(uiRowIndex, oldHasExpression); return GraphCommandResultBuilder.SUCCESS; } }; } DeleteListRowCommand(final List list,
                                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, list.getExpression().size()); }
@Test public void testGraphCommandExecuteRemoveMiddle() { uiModel.appendRow(new BaseGridRow()); uiModel.appendRow(new BaseGridRow()); final HasExpression firstRow = HasExpression.wrap(list, new LiteralExpression()); final HasExpression lastRow = HasExpression.wrap(list, new LiteralExpression()); list.getExpression().add(0, firstRow); list.getExpression().add(lastRow); makeCommand(1); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(2, list.getExpression().size()); assertEquals(firstRow, list.getExpression().get(0)); assertEquals(lastRow, list.getExpression().get(1)); }
@Test public void testGraphCommandUndo() { final LiteralExpression literalExpression = new LiteralExpression(); literalExpression.getText().setValue(VALUE); list.getExpression().add(HasExpression.wrap(list, literalExpression)); makeCommand(0); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(2, list.getExpression().size()); assertEquals(VALUE, ((LiteralExpression) list.getExpression().get(1).getExpression()).getText().getValue()); }