### Question:
QueryGraph implements Graph { @Override public EdgeExplorer createEdgeExplorer(final EdgeFilter edgeFilter) { if (!isInitialized()) throw new IllegalStateException("Call lookup before using this graph"); if (useEdgeExplorerCache) { int counter = -1; if (edgeFilter instanceof DefaultEdgeFilter) { DefaultEdgeFilter dee = (DefaultEdgeFilter) edgeFilter; counter = 0; if (dee.acceptsBackward()) counter = 1; if (dee.acceptsForward()) counter += 2; if (counter == 0) throw new IllegalStateException("You tried to use an edge filter blocking every access"); } else if (edgeFilter == EdgeFilter.ALL_EDGES) { counter = 4; } if (counter >= 0) { EdgeExplorer cached = cacheMap.get(counter); if (cached == null) { cached = createUncachedEdgeExplorer(edgeFilter); cacheMap.put(counter, cached); } return cached; } } return createUncachedEdgeExplorer(edgeFilter); } QueryGraph(Graph graph); private  QueryGraph(Graph graph, QueryGraph superQueryGraph); QueryGraph lookup(QueryResult fromRes, QueryResult toRes); void lookup(List<QueryResult> resList); @Override Graph getBaseGraph(); EdgeIteratorState getOriginalEdgeFromVirtNode(int nodeId); boolean isVirtualEdge(int edgeId); boolean isVirtualNode(int nodeId); QueryGraph setUseEdgeExplorerCache(boolean useEECache); boolean enforceHeading(int nodeId, double favoredHeading, boolean incoming); void unfavorVirtualEdgePair(int virtualNodeId, int virtualEdgeId); Set<EdgeIteratorState> getUnfavoredVirtualEdges(); void clearUnfavoredStatus(); @Override int getNodes(); @Override NodeAccess getNodeAccess(); @Override BBox getBounds(); @Override EdgeIteratorState getEdgeIteratorState(int origEdgeId, int adjNode); @Override EdgeExplorer createEdgeExplorer(final EdgeFilter edgeFilter); @Override /** * @see QueryGraph */ EdgeExplorer createEdgeExplorer(); @Override AllEdgesIterator getAllEdges(); @Override EdgeIteratorState edge(int a, int b); EdgeIteratorState edge(int a, int b, double distance, int flags); @Override EdgeIteratorState edge(int a, int b, double distance, boolean bothDirections); @Override Graph copyTo(Graph g); @Override GraphExtension getExtension();  }### Answer:
@Test public void testVirtEdges() { initGraph(g); EdgeIterator iter = g.createEdgeExplorer().setBaseNode(0); iter.next(); VirtualEdgeIterator vi = new VirtualEdgeIterator(2); vi.add(iter.detach(false)); assertTrue(vi.next()); }