### Question:
LocationIndexTree implements LocationIndex { @Override public int findID( double lat, double lon ) { QueryResult res = findClosest(lat, lon, EdgeFilter.ALL_EDGES); if (res == null) return -1; return res.getClosestNode(); } LocationIndexTree( Graph g, Directory dir ); int getMinResolutionInMeter(); LocationIndexTree setMinResolutionInMeter( int minResolutionInMeter ); LocationIndexTree setMaxRegionSearch( int numTiles ); @Override int findID( double lat, double lon ); @Override LocationIndex setResolution( int minResolutionInMeter ); @Override LocationIndex setApproximation( boolean approx ); @Override LocationIndexTree create( long size ); @Override boolean loadExisting(); @Override void flush(); @Override LocationIndex prepareIndex(); @Override void close(); @Override boolean isClosed(); @Override long getCapacity(); @Override void setSegmentSize( int bytes ); final boolean findNetworkEntries( double queryLat, double queryLon,
                                             TIntHashSet foundEntries, int iteration ); @Override QueryResult findClosest( final double queryLat, final double queryLon, final EdgeFilter edgeFilter );  }### Answer:
@Test public void testMoreReal() { Graph graph = createGHStorage(new EncodingManager("CAR")); NodeAccess na = graph.getNodeAccess(); na.setNode(1, 51.2492152, 9.4317166); na.setNode(0, 52, 9); na.setNode(2, 51.2, 9.4); na.setNode(3, 49, 10); graph.edge(1, 0, 1000, true); graph.edge(0, 2, 1000, true); graph.edge(0, 3, 1000, true).setWayGeometry(Helper.createPointList(51.21, 9.43)); LocationIndex index = createIndex(graph, -1); assertEquals(2, index.findID(51.2, 9.4)); }
@Test public void testWayGeometry() { Graph g = createTestGraphWithWayGeometry(); LocationIndex index = createIndex(g, -1); assertEquals(1, index.findID(0, 0)); assertEquals(1, index.findID(0, 0.1)); assertEquals(1, index.findID(0.1, 0.1)); assertEquals(1, index.findID(-0.5, -0.5)); }
@Test public void testFindingWayGeometry() { Graph g = createGHStorage(encodingManager); NodeAccess na = g.getNodeAccess(); na.setNode(10, 51.2492152, 9.4317166); na.setNode(20, 52, 9); na.setNode(30, 51.2, 9.4); na.setNode(50, 49, 10); g.edge(20, 50, 1, true).setWayGeometry(Helper.createPointList(51.25, 9.43)); g.edge(10, 20, 1, true); g.edge(20, 30, 1, true); LocationIndex index = createIndex(g, 2000); assertEquals(20, index.findID(51.25, 9.43)); }