Fix failing MongoDB exposesGeoSpatialFunctionality test case for travis.

Make distance check in exposesGeoSpatialFunctionality test case more robust against 
minor numeric differences. Travis CI seems to use an older Mongo DB version that produces a slightly different result than what we get.
This commit is contained in:
Thomas Darimont
2014-09-04 13:40:07 +02:00
parent caf5ba4edc
commit cba9500e47

View File

@@ -20,6 +20,7 @@ import static org.junit.Assert.*;
import java.util.List;
import org.hamcrest.number.IsCloseTo;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -104,6 +105,9 @@ public class CustomerRepositoryIntegrationTest {
GeoResults<Customer> result = repository.findByAddressLocationNear(referenceLocation, oneKilometer);
assertThat(result.getContent(), hasSize(1));
assertThat(result.getContent().get(0).getDistance(), is(new Distance(0.8624842788060683, Metrics.KILOMETERS)));
Distance distanceToFirstStore = result.getContent().get(0).getDistance();
assertThat(distanceToFirstStore.getMetric(), is(Metrics.KILOMETERS));
assertThat(distanceToFirstStore.getValue(), IsCloseTo.closeTo(0.862, 0.001));
}
}