DependencyGraphSimpleImpl implements DependencyGraph { @Override public String toString() { return this.getClass().getSimpleName() + "[Nodes:" + graph.vertexSet().size() + "; Edges:" + graph.edgeSet().size() + "]"; } @SuppressWarnings("squid:S3366") // Sonar warns that "this" may be used by another thread before the object is completely created. In this setting // here, there won't be a problem.  DependencyGraphSimpleImpl();  DependencyGraphSimpleImpl(DependencyGraph baseGraph); @Override DependencyGraph getBaseGraph(); @Override Node getOrCreateNodeByName(String name); @Override Node getNode(String name); @Override boolean hasNode(String name); @Override Dependency addDependency(Node from, Node to, DependencyType type); @Override Dependency getEdge(Node from, Node to); @Override Set<Dependency> getOutgoingEdges(Node node); @Override Set<Dependency> getOutgoingEdges(Node node, DependencyType dependencyType); @Override Set<Dependency> getIncomingEdges(Node node); @Override Set<Dependency> getIncomingEdges(Node node, DependencyType dependencyType); @Override DependencyGraph filter(final NodeFilter filter); @Override DependencyGraph filter(final EdgeFilter filter); @Override Collection<Node> getAllNodes(); @Override Collection<Dependency> getAllEdges(); AbstractGraph<Node, Dependency> getGraph(); @Override String toString();  }
@Test public void testToString() { setupSimpleGraph(); assertThat(graph.toString(), is("DependencyGraphSimpleImpl[Nodes:3; Edges:2]")); }