### Question:
SugiyamaLayoutService extends AbstractLayoutService { @Override public Layout createLayout(final Graph<?, ?> graph) { final Iterable<? extends Node> nodes = graphProcessor.getNodes(graph); final HashMap<String, Node> indexByUuid = createIndex(nodes); final LayeredGraph layeredGraph = createLayeredGraph(indexByUuid.values()); this.cycleBreaker.breakCycle(layeredGraph); this.vertexLayerer.createLayers(layeredGraph); this.vertexOrdering.orderVertices(layeredGraph); this.vertexPositioning.calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); final List<GraphLayer> orderedLayers = layeredGraph.getLayers(); return buildLayout(indexByUuid, orderedLayers); } @Inject  SugiyamaLayoutService(final CycleBreaker cycleBreaker,
                                 final VertexLayerer vertexLayerer,
                                 final VertexOrdering vertexOrdering,
                                 final VertexPositioning vertexPositioning,
                                 final GraphProcessor graphProcessor); @Override Layout createLayout(final Graph<?, ?> graph);  }### Answer:
@Test public void testCreateLayout() { final Graph<?, ?> graph = mock(Graph.class); final Iterable nodes = mock(Iterable.class); final HashMap indexByUuid = mock(HashMap.class); final Collection values = mock(Collection.class); final LayeredGraph layeredGraph = mock(LayeredGraph.class); final List layers = mock(List.class); when(graphProcessor.getNodes(graph)).thenReturn(nodes); when(indexByUuid.values()).thenReturn(values); when(layeredGraph.getLayers()).thenReturn(layers); doReturn(indexByUuid).when(layoutService).createIndex(nodes); doReturn(layeredGraph).when(layoutService).createLayeredGraph(values); layoutService.createLayout(graph); final InOrder inOrder = inOrder(graphProcessor, cycleBreaker, vertexLayerer, vertexOrdering, vertexPositioning); inOrder.verify(graphProcessor).getNodes(graph); inOrder.verify(cycleBreaker).breakCycle(layeredGraph); inOrder.verify(vertexLayerer).createLayers(layeredGraph); inOrder.verify(vertexOrdering).orderVertices(layeredGraph); inOrder.verify(vertexPositioning).calculateVerticesPositions(layeredGraph, DEFAULT_LAYER_ARRANGEMENT); verify(layoutService).buildLayout(indexByUuid, layers); }