begin with failing test

This commit is contained in:
Ken Stevens 2020-01-21 14:39:00 -05:00
parent eca21bec3e
commit a961a7c022
1 changed files with 19 additions and 0 deletions

View File

@ -3484,6 +3484,25 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
assertThat(ids, contains(locId)); assertThat(ids, contains(locId));
} }
@Test
public void testNearSearchNear() {
Location loc = new Location();
double latitude = 1000.0;
double longitude = 2000.0;
double offset = 50.0;
Location.LocationPositionComponent position = new Location.LocationPositionComponent().setLatitude(latitude).setLongitude(longitude);
loc.setPosition(position);
String locId = myLocationDao.create(loc).getId().toUnqualifiedVersionless().getValue();
SearchParameterMap map = new SearchParameterMap();
map.add(Location.SP_NEAR, new TokenParam((latitude + offset) + ":" + (longitude - offset)));
QuantityParam distance = new QuantityParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, offset * 2, "http://unitsofmeasure.org", "km");
map.add(Location.SP_NEAR_DISTANCE, distance);
List<String> ids = toUnqualifiedVersionlessIdValues(myLocationDao.search(map));
assertThat(ids, contains(locId));
}
private String toStringMultiline(List<?> theResults) { private String toStringMultiline(List<?> theResults) {
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
for (Object next : theResults) { for (Object next : theResults) {