Fix tests
This commit is contained in:
parent
d5e2170595
commit
309b67c010
|
@ -490,17 +490,17 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
|||
public void testSearchCompositeParamDate() {
|
||||
Observation o1 = new Observation();
|
||||
o1.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamDateN01");
|
||||
o1.setValue(new PeriodDt().setStart(new DateTimeDt("2001-01-01T11:11:11")));
|
||||
o1.setValue(new PeriodDt().setStart(new DateTimeDt("2001-01-01T11:11:11")).setEnd(new DateTimeDt("2001-01-01T12:11:11")));
|
||||
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
Observation o2 = new Observation();
|
||||
o2.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamDateN01");
|
||||
o2.setValue(new PeriodDt().setStart(new DateTimeDt("2001-01-01T12:12:12")));
|
||||
o2.setValue(new PeriodDt().setStart(new DateTimeDt("2001-01-02T12:12:12")).setEnd(new DateTimeDt("2001-01-02T12:11:11")));
|
||||
IIdType id2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
{
|
||||
TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamDateN01");
|
||||
DateParam v1 = new DateParam("2001-01-01T11:11:11");
|
||||
DateParam v1 = new DateParam("2001-01-01");
|
||||
CompositeParam<TokenParam, DateParam> val = new CompositeParam<TokenParam, DateParam>(v0, v1);
|
||||
IBundleProvider result = myObservationDao.search(Observation.SP_CODE_VALUE_DATE, val);
|
||||
assertEquals(1, result.size());
|
||||
|
|
|
@ -295,7 +295,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
|||
IIdType id2 = myObservationDao.create(o2, mySrd).getId();
|
||||
|
||||
{
|
||||
IBundleProvider found = myObservationDao.search(Observation.SP_VALUE_DATE, new DateParam("2001-01-02"));
|
||||
IBundleProvider found = myObservationDao.search(Observation.SP_VALUE_DATE, new DateParam("2001"));
|
||||
assertEquals(1, found.size());
|
||||
assertEquals(id2, found.getResources(0, 1).get(0).getIdElement());
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ import ca.uhn.fhir.jpa.entity.ResourceLink;
|
|||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
||||
import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.rest.api.SortOrderEnum;
|
||||
import ca.uhn.fhir.rest.api.SortSpec;
|
||||
import ca.uhn.fhir.rest.param.CompositeParam;
|
||||
|
@ -610,17 +612,17 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
public void testSearchCompositeParamDate() {
|
||||
Observation o1 = new Observation();
|
||||
o1.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamDateN01");
|
||||
o1.setValue(new Period().setStartElement(new DateTimeType("2001-01-01T11:11:11")));
|
||||
o1.setValue(new Period().setStartElement(new DateTimeType("2001-01-01T11:11:11")).setEndElement(new DateTimeType("2001-01-01T12:11:11")));
|
||||
IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
Observation o2 = new Observation();
|
||||
o2.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamDateN01");
|
||||
o2.setValue(new Period().setStartElement(new DateTimeType("2001-01-01T12:12:12")));
|
||||
o1.setValue(new Period().setStartElement(new DateTimeType("2001-01-02T11:11:11")).setEndElement(new DateTimeType("2001-01-02T12:11:11")));
|
||||
IIdType id2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
||||
{
|
||||
TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamDateN01");
|
||||
DateParam v1 = new DateParam("2001-01-01T11:11:11");
|
||||
DateParam v1 = new DateParam("2001-01-01");
|
||||
CompositeParam<TokenParam, DateParam> val = new CompositeParam<TokenParam, DateParam>(v0, v1);
|
||||
IBundleProvider result = myObservationDao.search(Observation.SP_CODE_VALUE_DATE, val);
|
||||
assertEquals(1, result.size());
|
||||
|
|
|
@ -283,7 +283,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
|||
IIdType id2 = myObservationDao.create(o2, mySrd).getId();
|
||||
|
||||
{
|
||||
IBundleProvider found = myObservationDao.search(Observation.SP_VALUE_DATE, new DateParam("2001-01-02"));
|
||||
IBundleProvider found = myObservationDao.search(Observation.SP_VALUE_DATE, new DateParam("2001"));
|
||||
assertEquals(1, found.size());
|
||||
assertEquals(id2, found.getResources(0, 1).get(0).getIdElement());
|
||||
}
|
||||
|
|
|
@ -2012,7 +2012,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateInvalidReference() throws IOException, Exception {
|
||||
public void testUpdateInvalidUrl() throws IOException, Exception {
|
||||
String methodName = "testUpdateInvalidReference";
|
||||
|
||||
Patient pt = new Patient();
|
||||
|
@ -2027,7 +2027,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test {
|
|||
ourLog.info(responseString);
|
||||
assertEquals(400, response.getStatusLine().getStatusCode());
|
||||
OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString);
|
||||
assertThat(oo.getIssue().get(0).getDiagnostics(), containsString("Can not update resource, resource body must contain an ID element for update (PUT) operation"));
|
||||
assertThat(oo.getIssue().get(0).getDiagnostics(), containsString("Can not update resource, request URL must contain an ID element for update (PUT) operation (it must be of the form [base]/[resource type]/[id])"));
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue