### 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<HasExpression> rowsToMove = rows.stream() .map(r -> uiModel.getRows().indexOf(r)) .map(i -> list.getExpression().get(i)) .collect(Collectors.toList()); CommandUtils.moveRows(list.getExpression(), rowsToMove, index); } }; } MoveRowsCommand(final List list,
                           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)); assertHasExpressionDefinitions(new int[]{1, 0}); }
@Test public void testGraphCommandExecuteMoveUpThreeRows() { addHasExpression(TEXT3); addUiModelRow(2); setupCommand(0, uiModel.getRow(2)); assertEquals(GraphCommandResultBuilder.SUCCESS, command.newGraphCommand(handler).execute(gce)); assertHasExpressionDefinitions(new int[]{1, 2, 0}); }
@Test public void testGraphCommandExecuteMoveDown() { setupCommand(1, uiModel.getRow(0)); assertEquals(GraphCommandResultBuilder.SUCCESS, command.newGraphCommand(handler).execute(gce)); assertHasExpressionDefinitions(new int[]{1, 0}); }
@Test public void testGraphCommandExecuteMoveDownThreeRows() { addHasExpression(TEXT3); addUiModelRow(2); setupCommand(2, uiModel.getRow(0)); assertEquals(GraphCommandResultBuilder.SUCCESS, command.newGraphCommand(handler).execute(gce)); assertHasExpressionDefinitions(new int[]{2, 0, 1}); }