@Test
public void testGetNearest() {

	getLogger().info("Preparing the benchmark..."); //$NON-NLS-1$
	assertNotNull(this.bounds);
	MapElementGridSet<MapPolyline> test = new MapElementGridSet<>(100, 100, this.bounds);
       test.addAll(this.reference);
       assertEquals(this.reference.size(), test.size());
       getLogger().info("Run test..."); //$NON-NLS-1$
   	Random rnd = new Random();
   	MapPolyline nearestData;
   	double minDistance, distance, x, y;
   	Point2d p;
   	final ArrayList<MapPolyline> nearest = new ArrayList<>();
   	boolean found = false;
   	int tries = 5;
   	do {
   		nearest.clear();
       	x = rnd.nextDouble()*this.bounds.getWidth()+this.bounds.getMinX();
       	y = rnd.nextDouble()*this.bounds.getHeight()+this.bounds.getMinY();
       	p = new Point2d(x,y);
       	minDistance = Double.MAX_VALUE;
       	for (MapPolyline line : this.reference) {
       		distance = line.getDistance(p);
       		if (distance<minDistance) {
       			minDistance = distance;
       		}
       	}
       	for (MapPolyline line : this.reference) {
       		distance = line.getDistance(p);
       		if (isEpsilonEquals(distance, minDistance)) {
       			nearest.add(line);
       		}
       	}
       	nearestData = test.getNearest(x, y);
       	assertNotNull(nearestData);
       	found = false;
       	for (MapPolyline poly : nearest) {
       		if (poly == nearestData) {
       			found = true;
       			break;
       		}
       	}
       	--tries;
   	}
   	while (!found && tries > 0);
   	assertTrue(found, "Polyline not found"); //$NON-NLS-1$
}