### Question:
DeleteCanvasControlPointCommand extends AbstractCanvasCommand { @Override public CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context) { ControlPointValidations.checkDeleteControlPoint(getViewControlPoints(context, candidate), index); return CanvasCommandResultBuilder.SUCCESS; } DeleteCanvasControlPointCommand(final Edge candidate,
                                           final int index); @Override CommandResult<CanvasViolation> allow(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); @Override String toString();  }### Answer:
@Test public void testChecks() { tested = new DeleteCanvasControlPointCommand(edge, 0); CommandResult<CanvasViolation> result = tested.allow(canvasHandler); assertFalse(CommandUtils.isError(result)); tested = new DeleteCanvasControlPointCommand(edge, 1); result = tested.allow(canvasHandler); assertFalse(CommandUtils.isError(result)); tested = new DeleteCanvasControlPointCommand(edge, 2); result = tested.allow(canvasHandler); assertFalse(CommandUtils.isError(result)); }
@Test(expected = IllegalArgumentException.class) public void testInvalidIndex() { tested = new DeleteCanvasControlPointCommand(edge, -1); tested.allow(canvasHandler); }
@Test(expected = IllegalArgumentException.class) public void testIndexForbidden() { tested = new DeleteCanvasControlPointCommand(edge, 3); tested.allow(canvasHandler); }