@Test public void addGraph_overlap() { UndirectedGraph<Integer, String> graph = Graphs.createUndirected(immutableGraph.config()); populateInputGraph(graph); // Add an edge that is in 'graph' (overlap) builder.addEdge(E12, N1, N2); builder.addGraph(graph); assertThat(builder.build()).isEqualTo(graph); }
@Test public void addGraph_inconsistentEdges() { UndirectedGraph<Integer, String> graph = Graphs.createUndirected(immutableGraph.config()); populateInputGraph(graph); builder.addEdge(E12, N5, N1); try { builder.addGraph(graph); fail( "Should have rejected a graph whose edge definitions were inconsistent with existing" + "builder state"); } catch (IllegalArgumentException expected) { } }
@Test public void addGraph() { UndirectedGraph<Integer, String> graph = Graphs.createUndirected(immutableGraph.config()); populateInputGraph(graph); assertThat(builder.addGraph(graph).build()).isEqualTo(graph); }
@Test public void copyOf() { UndirectedGraph<Integer, String> graph = Graphs.createUndirected(immutableGraph.config()); populateInputGraph(graph); assertThat(ImmutableUndirectedGraph.copyOf(graph)).isEqualTo(graph); }