@Test @SuppressWarnings("unchecked") public void testExecuteNullSourceNode() { when(candidate.getSourceNode()).thenReturn(null); final CommandResult<CanvasViolation> result = tested.execute(canvasHandler); assertNotEquals(CommandResult.Type.ERROR, result.getType()); verify(canvasHandler, times(1)).deregister(eq(candidate)); verify(canvasHandler, never()).notifyCanvasElementUpdated(eq(source)); verify(canvasHandler, times(1)).notifyCanvasElementUpdated(eq(target)); }
@Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!checkShapeNotNull(context, candidate.getUUID())) { return buildResult(); } context.deregister(candidate); final Node source = candidate.getSourceNode(); if (null != source) { context.notifyCanvasElementUpdated(source); } final Node target = candidate.getTargetNode(); if (null != target) { context.notifyCanvasElementUpdated(target); } return buildResult(); }
DeleteCanvasConnectorCommand extends AbstractCanvasCommand { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!checkShapeNotNull(context, candidate.getUUID())) { return buildResult(); } context.deregister(candidate); final Node source = candidate.getSourceNode(); if (null != source) { context.notifyCanvasElementUpdated(source); } final Node target = candidate.getTargetNode(); if (null != target) { context.notifyCanvasElementUpdated(target); } return buildResult(); } }
DeleteCanvasConnectorCommand extends AbstractCanvasCommand { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!checkShapeNotNull(context, candidate.getUUID())) { return buildResult(); } context.deregister(candidate); final Node source = candidate.getSourceNode(); if (null != source) { context.notifyCanvasElementUpdated(source); } final Node target = candidate.getTargetNode(); if (null != target) { context.notifyCanvasElementUpdated(target); } return buildResult(); } DeleteCanvasConnectorCommand(final Edge candidate); }
DeleteCanvasConnectorCommand extends AbstractCanvasCommand { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!checkShapeNotNull(context, candidate.getUUID())) { return buildResult(); } context.deregister(candidate); final Node source = candidate.getSourceNode(); if (null != source) { context.notifyCanvasElementUpdated(source); } final Node target = candidate.getTargetNode(); if (null != target) { context.notifyCanvasElementUpdated(target); } return buildResult(); } DeleteCanvasConnectorCommand(final Edge candidate); @Override CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); Edge getCandidate(); @Override String toString(); }
DeleteCanvasConnectorCommand extends AbstractCanvasCommand { @Override public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { if (!checkShapeNotNull(context, candidate.getUUID())) { return buildResult(); } context.deregister(candidate); final Node source = candidate.getSourceNode(); if (null != source) { context.notifyCanvasElementUpdated(source); } final Node target = candidate.getTargetNode(); if (null != target) { context.notifyCanvasElementUpdated(target); } return buildResult(); } DeleteCanvasConnectorCommand(final Edge candidate); @Override CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); Edge getCandidate(); @Override String toString();  }