add negative test

This commit is contained in:
Ken Stevens 2020-01-22 09:25:43 -05:00
parent 02a95115a4
commit 5da2823553
1 changed files with 22 additions and 8 deletions

View File

@ -3520,6 +3520,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
loc.setPosition(position); loc.setPosition(position);
String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue(); String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue();
{ // In the box
double offset = 50.0; double offset = 50.0;
SearchParameterMap map = myMatchUrlService.translateMatchUrl( SearchParameterMap map = myMatchUrlService.translateMatchUrl(
"Location?" + "Location?" +
@ -3530,6 +3531,19 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
List<String> ids = toUnqualifiedVersionlessIdValues(myLocationDao.search(map)); List<String> ids = toUnqualifiedVersionlessIdValues(myLocationDao.search(map));
assertThat(ids, contains(locId)); 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 @Test
public void testBadCoordsFormat() { public void testBadCoordsFormat() {