### Question:
SugiyamaLayoutService extends AbstractLayoutService { HashMap<String, Node> createIndex(final Iterable<? extends Node> nodes) { final HashMap<String, Node> indexByUuid = new HashMap<>(); for (final Node n : nodes) { if (!(n.getContent() instanceof HasBounds)) { continue; } indexByUuid.put(n.getUUID(), n); } return indexByUuid; } @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 testCreateIndex() { final Node nodeWithoutBounds = mock(Node.class); final String noBoundsId = "not"; final String id1 = "id1"; final String id2 = "id2"; final Object notHasBoundsInstance = mock(Object.class); final Node n1 = createNode(id1); final Node n2 = createNode(id2); final List<Node> nodes = Arrays.asList(n1, n2, nodeWithoutBounds); when(nodeWithoutBounds.getUUID()).thenReturn(noBoundsId); when(nodeWithoutBounds.getContent()).thenReturn(notHasBoundsInstance); final HashMap<String, Node> index = layoutService.createIndex(nodes); assertTrue(index.containsKey(id1)); assertTrue(index.containsKey(id2)); assertFalse(index.containsKey(noBoundsId)); assertEquals(n1, index.get(id1)); assertEquals(n2, index.get(id2)); }