@Test public void testGetVertices() { final LayeredGraph graph = new LayeredGraph(); final GraphLayer layer1 = mock(GraphLayer.class); final GraphLayer layer2 = mock(GraphLayer.class); final List<Vertex> vertices1 = new ArrayList<>(); final List<Vertex> vertices2 = new ArrayList<>(); final Vertex v1 = mock(Vertex.class); final Vertex v2 = mock(Vertex.class); final Vertex v3 = mock(Vertex.class); vertices1.add(v1); vertices1.add(v2); vertices1.add(v3); when(layer1.getVertices()).thenReturn(vertices1); when(layer2.getVertices()).thenReturn(vertices2); graph.getLayers().add(layer1); graph.getLayers().add(layer2); final Set<Vertex> actual = tested.getVertices(graph); assertTrue(actual.contains(v1)); assertTrue(actual.contains(v2)); assertTrue(actual.contains(v3)); assertEquals(3, actual.size()); }
Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); }
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); } }
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); }  }
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); }  @Override void calculateVerticesPositions(final ReorderedGraph graph,
                                           final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
                                       final List<OrientedEdge> edges,
                                       final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
                                      final Set<Vertex> vertices); }
DefaultVertexPositioning implements VertexPositioning { Set<Vertex> getVertices(final LayeredGraph layered) { return layered.getLayers().stream() .flatMap(l -> l.getVertices().stream()).collect(Collectors.toSet()); }  @Override void calculateVerticesPositions(final ReorderedGraph graph,
                                           final LayerArrangement arrangement); boolean removeVirtualVertex(final OrientedEdge edge,
                                       final List<OrientedEdge> edges,
                                       final Set<Vertex> vertices); void removeVirtualVertices(final List<OrientedEdge> edges,
                                      final Set<Vertex> vertices);  }