### Question:
DeleteControlPointCommand extends AbstractControlPointCommand { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { checkDeleteControlPoint(getEdgeControlPoints(context).getControlPoints(), index); return GraphCommandResultBuilder.SUCCESS; } DeleteControlPointCommand(final @MapsTo("edgeUUID") String edgeUUID,
                                     final @MapsTo("index") int index); @Override CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context);  }### Answer:
@Test public void testChecks() { tested = new DeleteControlPointCommand(EDGE_UUID, 0); CommandResult<RuleViolation> result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); tested = new DeleteControlPointCommand(EDGE_UUID, 1); result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); tested = new DeleteControlPointCommand(EDGE_UUID, 2); result = tested.check(graphCommandExecutionContext); assertFalse(CommandUtils.isError(result)); }
@Test(expected = IllegalArgumentException.class) public void testInvalidIndex() { tested = new DeleteControlPointCommand(EDGE_UUID, -1); tested.check(graphCommandExecutionContext); }
@Test(expected = IllegalArgumentException.class) public void testIndexForbidden() { tested = new DeleteControlPointCommand(EDGE_UUID, 3); tested.check(graphCommandExecutionContext); }