@Test
public void shouldDetectCircularDependencies() {

    final Graph graph = new Graph();
    final Node<Integer> intNode = new Node<>(Integer.class);
    final Node<Float> floatNode = new Node<>(Float.class);
    try {
        graph.addEdge(intNode, floatNode).addEdge(floatNode, intNode);
        fail("It should have thrown a CircularDependencyException");
    } catch (Exception e) {
        assertThat(e, instanceOf(CircularDependencyException.class));
    }
}