test passes

This commit is contained in:
Ken Stevens 2020-02-01 20:15:58 -05:00
parent fb1eb7ca8f
commit c375c66f15
2 changed files with 19 additions and 10 deletions

View File

@ -193,6 +193,8 @@ public class SearchBuilder implements ISearchBuilder {
.findFirst()
.map(QuantityParam.class::cast)
.ifPresent(theParams::setNearDistanceParam);
// Need to remove near-distance or it we'll get a hashcode predicate for it
theParams.remove(Location.SP_NEAR_DISTANCE);
}
}

View File

@ -4300,6 +4300,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
"&" +
Location.SP_NEAR_DISTANCE + "=" + bigEnoughDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
myCaptureQueriesListener.clear();
Bundle actual = ourClient
.search()
.byUrl(ourServerBase + "/" + url)
@ -4307,23 +4308,29 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test {
.prettyPrint()
.returnBundle(Bundle.class)
.execute();
//@formatter:on
// FIXME KHS hmm this test should be passing now...?
myCaptureQueriesListener.logSelectQueries();
assertEquals(1, actual.getEntry().size());
assertEquals(locId.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart());
}
{ // Outside the box
double tooSmallDistance = CoordCalculatorTest.DISTANCE_KM_CHIN_TO_UHN / 2;
// FIXME KHS add this part
String url = "/Location?" +
Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + URLEncoder.encode(":") + CoordCalculatorTest.LONGITUDE_CHIN +
"&" +
Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + URLEncoder.encode("|http://unitsofmeasure.org|km");
// SearchParameterMap map = myMatchUrlService.translateMatchUrl(
// "Location?" +
// Location.SP_NEAR + "=" + CoordCalculatorTest.LATITUDE_CHIN + ":" + CoordCalculatorTest.LONGITUDE_CHIN +
// "&" +
// Location.SP_NEAR_DISTANCE + "=" + tooSmallDistance + "|http://unitsofmeasure.org|km", myFhirCtx.getResourceDefinition("Location"));
myCaptureQueriesListener.clear();
Bundle actual = ourClient
.search()
.byUrl(ourServerBase + "/" + url)
.encodedJson()
.prettyPrint()
.returnBundle(Bundle.class)
.execute();
myCaptureQueriesListener.logSelectQueries();
// List<String> ids = toUnqualifiedVersionlessIdValues(myLocationDao.search(map));
// assertThat(ids.size(), is(0));
assertEquals(0, actual.getEntry().size());
}
}