add negative test
@@ -3520,6 +3520,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
loc.setPosition(position);
String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue();
+ { // In the box
double offset = 50.0;
SearchParameterMap map = myMatchUrlService.translateMatchUrl(
"Location?" +
@@ -3530,6 +3531,19 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
List<String> ids = toUnqualifiedVersionlessIdValues(myLocationDao.search(map));
assertThat(ids, contains(locId));
}
+ { // Outside the box
+ double offset = 50.0;
+ SearchParameterMap map = myMatchUrlService.translateMatchUrl(
+ "Location?" +
+ Location.SP_NEAR + "=" + (latitude + offset) + ":" + (longitude - offset) +
+ "&" +
+ Location.SP_NEAR_DISTANCE + "=" + (offset / 2) + "|http://unitsofmeasure.org|km", myFhirCtx.getResourceDefinition("Location"));
+
+ List<String> ids = toUnqualifiedVersionlessIdValues(myLocationDao.search(map));
+ assertThat(ids.size(), is(0));
+ }
+
+ }
@Test
public void testBadCoordsFormat() {
