@SuppressWarnings("unchecked") @Test public void shouldNotReportSingleItemComponents() { classGraph.addEdge(dep(foo, bar, AccessType.COMPOSED), foo, bar); testee.analyse(new CodeGraphs(classGraph), r); verify(r, never()).visitClassStronglyConnectedComponent(any(DirectedGraph.class)); }
@SuppressWarnings("unchecked") @Test public void shouldNotBreakDownSmallConnectedPackageComponents() { classGraph.addEdge(dep(foo, bar, AccessType.COMPOSED), foo, bar); classGraph.addEdge(dep(bar, foo, AccessType.COMPOSED), bar, foo); testee.analyse(new CodeGraphs(classGraph), r); verify(r).visitPackageStronglyConnectedComponent(any(DirectedGraph.class)); verify(r, never()).visitSubCycle(any(DirectedGraph.class)); }
@SuppressWarnings("unchecked") @Test public void shouldFindAndBreakDownStronglyConnectedClassComponentsLargerThanThreshold() { classGraph.addEdge(dep(foo, bar, AccessType.COMPOSED), foo, bar); classGraph.addEdge(dep(foo, bar, AccessType.COMPOSED), bar, far); classGraph.addEdge(dep(foo, bar, AccessType.COMPOSED), far, foo); testee.analyse(new CodeGraphs(classGraph), r); verify(r).visitClassStronglyConnectedComponent(any(DirectedGraph.class)); verify(r).endClassStronglyConnectedComponent(any(DirectedGraph.class)); verify(r).visitClassSubCycle(any(DirectedGraph.class)); }
@Test public void shouldSendCodeStatsToVisitor() { classGraph.addEdge(dep(foo, bar, AccessType.COMPOSED), foo, bar); testee.analyse(new CodeGraphs(classGraph), r); verify(r).start(any(CodeStats.class)); }
@Test public void shouldSignalEndOfAnalysis() { testee.analyse(new CodeGraphs(classGraph), r); verify(r).end(); }