### Question:
QueryGraph implements Graph { public QueryGraph lookup(QueryResult fromRes, QueryResult toRes) { List<QueryResult> results = new ArrayList<QueryResult>(2); results.add(fromRes); results.add(toRes); lookup(results); return this; } 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 testEdgesShareOneNode() { initGraph(g); EdgeIteratorState iter = GHUtility.getEdge(g, 0, 2); QueryResult res1 = createLocationResult(0.5, 0, iter, 0, EDGE); iter = GHUtility.getEdge(g, 1, 0); QueryResult res2 = createLocationResult(1.5, 2, iter, 0, EDGE); QueryGraph queryGraph = new QueryGraph(g); queryGraph.lookup(Arrays.asList(res1, res2)); assertEquals(new GHPoint(0.5, 0), res1.getSnappedPoint()); assertEquals(new GHPoint(1.300019, 1.899962), res2.getSnappedPoint()); assertNotNull(GHUtility.getEdge(queryGraph, 0, 4)); assertNotNull(GHUtility.getEdge(queryGraph, 0, 3)); }