### Question:
SetBuiltinAggregatorCommand 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) { dtable.setAggregation(aggregator); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { dtable.setAggregation(oldAggregator.orElse(null)); return GraphCommandResultBuilder.SUCCESS; } }; } SetBuiltinAggregatorCommand(final DecisionTable dtable,
                                       final BuiltinAggregator aggregator,
                                       final org.uberfire.mvp.Command canvasOperation);   }### Answer:
@Test public void testGraphCommandAllow() { makeCommand(OLD_AGGREGATOR); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.allow(gce)); }
@Test public void testGraphCommandExecute() { makeCommand(OLD_AGGREGATOR); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(NEW_AGGREGATOR, dtable.getAggregation()); }
@Test public void testGraphCommandUndo() { makeCommand(OLD_AGGREGATOR); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(OLD_AGGREGATOR, dtable.getAggregation()); }
@Test public void testGraphCommandUndoWhenOriginallyNull() { makeCommand(null); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertNull(dtable.getAggregation()); }