@Test @SuppressWarnings("unchecked") public void testCanvasCommandNotAllowed() { when(canvasCommand.allow(eq(canvasHandler))).thenReturn(CANVAS_COMMAND_FAILED); CommandResult<CanvasViolation> result = tested.allow(canvasHandler); verify(graphCommand, times(1)).allow(eq(graphContext)); verify(canvasCommand, times(1)).allow(eq(canvasHandler)); assertEquals(CommandResult.Type.ERROR, result.getType()); }
@Override public CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context) { final CommandResult<CanvasViolation> result = performOperationOnGraph(context, CommandOperation.ALLOW); if (canDoNexOperation(result)) { return performOperationOnCanvas(context, CommandOperation.ALLOW); } return result; }
AbstractCanvasGraphCommand extends AbstractCanvasCommand implements HasGraphCommand<AbstractCanvasHandler> { @Override public CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context) { final CommandResult<CanvasViolation> result = performOperationOnGraph(context, CommandOperation.ALLOW); if (canDoNexOperation(result)) { return performOperationOnCanvas(context, CommandOperation.ALLOW); } return result; } }
AbstractCanvasGraphCommand extends AbstractCanvasCommand implements HasGraphCommand<AbstractCanvasHandler> { @Override public CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context) { final CommandResult<CanvasViolation> result = performOperationOnGraph(context, CommandOperation.ALLOW); if (canDoNexOperation(result)) { return performOperationOnCanvas(context, CommandOperation.ALLOW); } return result; }  }
AbstractCanvasGraphCommand extends AbstractCanvasCommand implements HasGraphCommand<AbstractCanvasHandler> { @Override public CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context) { final CommandResult<CanvasViolation> result = performOperationOnGraph(context, CommandOperation.ALLOW); if (canDoNexOperation(result)) { return performOperationOnCanvas(context, CommandOperation.ALLOW); } return result; }  @Override Command<GraphCommandExecutionContext, RuleViolation> getGraphCommand(final AbstractCanvasHandler context); Command<AbstractCanvasHandler, CanvasViolation> getCanvasCommand(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); }
AbstractCanvasGraphCommand extends AbstractCanvasCommand implements HasGraphCommand<AbstractCanvasHandler> { @Override public CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context) { final CommandResult<CanvasViolation> result = performOperationOnGraph(context, CommandOperation.ALLOW); if (canDoNexOperation(result)) { return performOperationOnCanvas(context, CommandOperation.ALLOW); } return result; }  @Override Command<GraphCommandExecutionContext, RuleViolation> getGraphCommand(final AbstractCanvasHandler context); Command<AbstractCanvasHandler, CanvasViolation> getCanvasCommand(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context);  }