for (Object node : e.getPath()) { if (path1.length() > 0) { path1.append("->");
throw new CycleDetectionException(Arrays.asList(this)); throw new CycleDetectionException(path);
for (Object node : e.getPath()) { if (path1.length() > 0) { path1.append("->");
throw new CycleDetectionException(Arrays.asList(this)); throw new CycleDetectionException(path);
@Test public void testSelfCycleDetection() { Simple a = context.create("a"); try { a.addChild(A, a); fail("Was expecting cycle detection"); } catch (CycleDetectionException ok) { assertEquals(Arrays.asList(a), ok.getPath()); } }
@Test public void testSelfCycleDetection() { Simple a = context.create("a"); try { a.addChild(A, a); fail("Was expecting cycle detection"); } catch (CycleDetectionException ok) { assertEquals(Arrays.asList(a), ok.getPath()); } }
@Test public void testCycleDetection() { Simple a = context.create("a"); Simple b = context.create("b"); Simple c = context.create("c"); a.addChild(B, b); b.addChild(C, c); try { c.addChild(A, a); fail("Was expecting cycle detection"); } catch (CycleDetectionException ok) { assertEquals(Arrays.asList(a, b, c), ok.getPath()); } }
@Test public void testCycleDetection() { Simple a = context.create("a"); Simple b = context.create("b"); Simple c = context.create("c"); a.addChild(B, b); b.addChild(C, c); try { c.addChild(A, a); fail("Was expecting cycle detection"); } catch (CycleDetectionException ok) { assertEquals(Arrays.asList(a, b, c), ok.getPath()); } }