### Question:
AddNodeCommand extends RegisterNodeCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final SafeDeleteNodeCommand undoCommand = new SafeDeleteNodeCommand(getCandidate()); return undoCommand.execute(context); } AddNodeCommand(final @MapsTo("candidate") Node candidate); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); @Override String toString();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testUndo() { CommandResult<RuleViolation> result = tested.undo(graphCommandExecutionContext); assertEquals(CommandResult.Type.INFO, result.getType()); verify(graph, times(1)).removeNode(eq(UUID)); verify(graphIndex, times(1)).removeNode(eq(node)); verify(graphIndex, times(0)).removeEdge(any(Edge.class)); verify(graph, times(0)).addNode(eq(node)); verify(graphIndex, times(0)).addNode(eq(node)); verify(graphIndex, times(0)).addEdge(any(Edge.class)); }