### Question:
AddConnectorCommand extends AbstractGraphCompositeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { getMutableIndex(context).addEdge(edge); final CommandResult<RuleViolation> results = super.execute(context); if (CommandUtils.isError(results)) { getMutableIndex(context).removeEdge(edge); } return results; } AddConnectorCommand(final @MapsTo("nodeUUID") String nodeUUID,
                               final @MapsTo("edge") Edge edge,
                               final @MapsTo("magnet") Connection connection);  AddConnectorCommand(final Node<?, Edge> sourceNode,
                               final Edge edge,
                               final Connection connection); @Override CommandResult<RuleViolation> allow(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); Edge getEdge(); Connection getConnection(); Node<?, Edge> getSourceNode(); @Override String toString();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); assertTrue(node.getOutEdges().size() == 1); assertEquals(edge, node.getOutEdges().get(0)); verify(graphIndex, times(1)).addEdge(eq(edge)); verify(graphIndex, times(0)).addNode(any(Node.class)); }