### Question:
MoveRowsCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                           VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { moveRows(index); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { moveRows(oldIndex); return GraphCommandResultBuilder.SUCCESS; } private void moveRows(final int index) { final java.util.List<List> rowsToMove = rows .stream() .map(r -> uiModel.getRows().indexOf(r)) .map(i -> relation.getRow().get(i)) .collect(Collectors.toList()); final java.util.List<List> rows = relation.getRow(); CommandUtils.moveRows(rows, rowsToMove, index); } }; } MoveRowsCommand(final Relation relation,
                           final DMNGridData uiModel,
                           final int index,
                           final java.util.List<GridRow> rows,
                           final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }### Answer:
@Test public void testGraphCommandAllow() { setupCommand(0, uiModel.getRow(0)); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.allow(gce)); }
@Test public void testGraphCommandExecuteMoveUp() { setupCommand(0, uiModel.getRow(1)); assertEquals(GraphCommandResultBuilder.SUCCESS, command.newGraphCommand(handler).execute(gce)); assertRelationDefinition(1, 0); }
@Test public void testGraphCommandExecuteMoveDown() { setupCommand(1, uiModel.getRow(0)); assertEquals(GraphCommandResultBuilder.SUCCESS, command.newGraphCommand(handler).execute(gce)); assertRelationDefinition(1, 0); }