Add test for millisecond precision

This commit is contained in:
David Gileadi 2020-04-10 15:39:04 -07:00 committed by James Agnew
parent 37dcf589de
commit 461739fb32
1 changed files with 20 additions and 0 deletions

View File

@ -1512,6 +1512,8 @@ public class GenericClientR4Test {
DateTimeDt now = DateTimeDt.withCurrentTime(); DateTimeDt now = DateTimeDt.withCurrentTime();
String dateString = now.getValueAsString().substring(0, 10); String dateString = now.getValueAsString().substring(0, 10);
DateTimeDt nowWithMillis = new DateTimeDt(new Date(), TemporalPrecisionEnum.MILLI, TimeZone.getDefault());
client.search() client.search()
.forResource("Patient") .forResource("Patient")
.where(Patient.BIRTHDATE.after().day(dateString)) .where(Patient.BIRTHDATE.after().day(dateString))
@ -1584,6 +1586,24 @@ public class GenericClientR4Test {
assertEquals("http://example.com/fhir/Patient?birthdate=gt" + now.getValueAsString(), UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString())); assertEquals("http://example.com/fhir/Patient?birthdate=gt" + now.getValueAsString(), UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
idx++; idx++;
client.search()
.forResource("Patient")
.where(Patient.BIRTHDATE.after().millis("2011-01-02T22:33:01.123Z"))
.returnBundle(Bundle.class)
.execute();
assertEquals("http://example.com/fhir/Patient?birthdate=gt2011-01-02T22:33:01.123Z", UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
idx++;
client.search()
.forResource("Patient")
.where(Patient.BIRTHDATE.after().millis(nowWithMillis.getValue()))
.returnBundle(Bundle.class)
.execute();
assertEquals("http://example.com/fhir/Patient?birthdate=gt" + nowWithMillis.getValueAsString(), UrlUtil.unescape(capt.getAllValues().get(idx).getURI().toString()));
idx++;
client.search() client.search()
.forResource("Patient") .forResource("Patient")
.where(Patient.BIRTHDATE.after().now()) .where(Patient.BIRTHDATE.after().now())