@Test
    void cycles_gives_exception() {
        ComponentGraph componentGraph = new ComponentGraph();

        Node node1 = mockComponentNode(ComponentCausingCycle.class);
        Node node2 = mockComponentNode(ComponentCausingCycle.class);

        node1.inject(node2);
        node2.inject(node1);

        componentGraph.add(node1);
        componentGraph.add(node2);

        try {
            componentGraph.complete();
            fail("Cycle exception expected.");
        } catch (Throwable e) {
            assertTrue(e.getMessage().contains("cycle"));
            assertTrue(e.getMessage().contains("ComponentCausingCycle"));
        }
    }
@author gjoranv
@author Tony Vaagenes
@author ollivir
container-core/src/test/java/com/yahoo/container/di/componentgraph/core/ComponentGraphTest.java