### Question:
AddParameterCommand 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) { function.getFormalParameter().add(parameter); parameter.getName().setValue(name); parameter.setParent(function); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { function.getFormalParameter().remove(parameter); return GraphCommandResultBuilder.SUCCESS; } }; } AddParameterCommand(final FunctionDefinition function,
                               final InformationItem parameter,
                               final org.uberfire.mvp.Command canvasOperation);   }### Answer:
@Test public void testGraphCommandAllow() { final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.allow(gce)); }
@Test public void testGraphCommandExecuteWithParameters() { final InformationItem otherParameter = new InformationItem(); function.getFormalParameter().add(otherParameter); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertFormalParameters(2, otherParameter, parameter); assertEquals(function, parameter.getParent()); }
@Test public void testGraphCommandExecuteWithNoParameters() { final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertFormalParameters(1, parameter); assertEquals(function, parameter.getParent()); }
@Test public void testGraphCommandUndoWithParameters() { final InformationItem otherParameter = new InformationItem(); function.getFormalParameter().add(otherParameter); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertFormalParameters(1, otherParameter); }
@Test public void testGraphCommandUndoWithNoParameters() { final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertFormalParameters(0); }