### Question:
QueryGraph implements Graph { public void unfavorVirtualEdgePair(int virtualNodeId, int virtualEdgeId) { if (!isVirtualNode(virtualNodeId)) { throw new IllegalArgumentException("Node id " + virtualNodeId + " must be a virtual node."); } VirtualEdgeIteratorState incomingEdge = (VirtualEdgeIteratorState) getEdgeIteratorState(virtualEdgeId, virtualNodeId); VirtualEdgeIteratorState reverseEdge = (VirtualEdgeIteratorState) getEdgeIteratorState( virtualEdgeId, incomingEdge.getBaseNode()); incomingEdge.setUnfavored(true); unfavoredEdges.add(incomingEdge); reverseEdge.setUnfavored(true); unfavoredEdges.add(reverseEdge); } 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 testunfavorVirtualEdgePair() { initHorseshoeGraph(g); EdgeIteratorState edge = GHUtility.getEdge(g, 0, 1); QueryResult qr = fakeEdgeQueryResult(edge, 1.5, 0, 0); QueryGraph queryGraph = lookup(qr); queryGraph.unfavorVirtualEdgePair(2, 1); VirtualEdgeIteratorState incomingEdge = (VirtualEdgeIteratorState) queryGraph.getEdgeIteratorState(1, 2); VirtualEdgeIteratorState incomingEdgeReverse = (VirtualEdgeIteratorState) queryGraph.getEdgeIteratorState(1, incomingEdge.getBaseNode()); boolean expect = true; assertEquals(expect, incomingEdge.get(EdgeIteratorState.UNFAVORED_EDGE)); assertEquals(expect, incomingEdgeReverse.get(EdgeIteratorState.UNFAVORED_EDGE)); assertEquals(new LinkedHashSet<>(Arrays.asList(incomingEdge, incomingEdgeReverse)), queryGraph.getUnfavoredVirtualEdges()); queryGraph.clearUnfavoredStatus(); expect = false; assertEquals(expect, incomingEdge.get(EdgeIteratorState.UNFAVORED_EDGE)); assertEquals(expect, incomingEdgeReverse.get(EdgeIteratorState.UNFAVORED_EDGE)); assertEquals(new LinkedHashSet<>(), queryGraph.getUnfavoredVirtualEdges()); }