@Test public void equivalent_propertiesDiffer() { graph.putEdge(N1, N2); MutableGraph<Integer> g2 = GraphBuilder.from(graph).allowsSelfLoops(!graph.allowsSelfLoops()).build(); g2.putEdge(N1, N2); assertThat(graph).isEqualTo(g2); }
@Override public EndpointPair<V> addEdge(V sourceVertex, V targetVertex) { assertVertexExist(sourceVertex); assertVertexExist(targetVertex); if (containsEdge(sourceVertex, targetVertex)) { return null; } if (!graph.allowsSelfLoops() && sourceVertex.equals(targetVertex)) { throw new IllegalArgumentException(LOOPS_NOT_ALLOWED); } graph.putEdge(sourceVertex, targetVertex); return createEdge(sourceVertex, targetVertex); }
if (!graph.allowsSelfLoops() && sourceVertex.equals(targetVertex)) { throw new IllegalArgumentException(LOOPS_NOT_ALLOWED);
@Test public void equivalent_propertiesDiffer() { graph.putEdge(N1, N2); MutableGraph<Integer> g2 = GraphBuilder.from(graph).allowsSelfLoops(!graph.allowsSelfLoops()).build(); g2.putEdge(N1, N2); assertThat(graph).isEqualTo(g2); }