### Question:
QueryGraph implements Graph { @Override public EdgeExplorer createEdgeExplorer(final EdgeFilter edgeFilter) { final EdgeExplorer mainExplorer = mainGraph.createEdgeExplorer(edgeFilter); final VirtualEdgeIterator virtualEdgeIterator = new VirtualEdgeIterator(edgeFilter, null); return new EdgeExplorer() { @Override public EdgeIterator setBaseNode(int baseNode) { if (isVirtualNode(baseNode)) { List<EdgeIteratorState> virtualEdges = virtualEdgesAtVirtualNodes.get(baseNode - mainNodes); return virtualEdgeIterator.reset(virtualEdges); } else { List<EdgeIteratorState> virtualEdges = virtualEdgesAtRealNodes.get(baseNode); if (virtualEdges == null) { return mainExplorer.setBaseNode(baseNode); } else { return virtualEdgeIterator.reset(virtualEdges); } } } }; } private  QueryGraph(Graph graph, List<QueryResult> queryResults); private  QueryGraph(Graph graph, QueryGraph superQueryGraph); static QueryGraph lookup(Graph graph, QueryResult qr); static QueryGraph lookup(Graph graph, QueryResult fromQR, QueryResult toQR); static QueryGraph lookup(Graph graph, List<QueryResult> queryResults); @Override Graph getBaseGraph(); EdgeIteratorState getOriginalEdgeFromVirtNode(int nodeId); boolean isVirtualEdge(int edgeId); boolean isVirtualNode(int nodeId); boolean enforceHeading(int nodeId, double favoredHeading, boolean incoming); void unfavorVirtualEdgePair(int virtualNodeId, int virtualEdgeId); Set<EdgeIteratorState> getUnfavoredVirtualEdges(); void clearUnfavoredStatus(); @Override int getNodes(); @Override int getEdges(); @Override NodeAccess getNodeAccess(); @Override BBox getBounds(); @Override EdgeIteratorState getEdgeIteratorState(int origEdgeId, int adjNode); @Override EdgeExplorer createEdgeExplorer(final EdgeFilter edgeFilter); @Override EdgeExplorer createEdgeExplorer(); @Override AllEdgesIterator getAllEdges(); @Override EdgeIteratorState edge(int a, int b); @Override EdgeIteratorState edge(int a, int b, double distance, boolean bothDirections); @Override Graph copyTo(Graph g); @Override TurnCostStorage getTurnCostStorage(); @Override Weighting wrapWeighting(Weighting weighting); @Override int getOtherNode(int edge, int node); @Override boolean isAdjacentToNode(int edge, int node); Graph getMainGraph();  }### Answer:
@Test public void testVirtEdges() { initGraph(g); EdgeIterator iter = g.createEdgeExplorer().setBaseNode(0); iter.next(); List<EdgeIteratorState> vEdges = Collections.singletonList(iter.detach(false)); VirtualEdgeIterator vi = new VirtualEdgeIterator(EdgeFilter.ALL_EDGES, vEdges); assertTrue(vi.next()); }