Search in sources :

Example 11 with Subject

use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project cqf-ruler by DBCG.

the class ReportProviderIT method testSubjectIsNotPatientOrGroup.

@Test
public void testSubjectIsNotPatientOrGroup() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2021-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2021-12-31"));
    params.addParameter().setName("subject").setValue(new StringType("ra-patient01"));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 12 with Subject

use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project cqf-ruler by DBCG.

the class ReportProviderIT method testMissingPeriodStartParam.

@Test
public void testMissingPeriodStartParam() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodEnd").setValue(new StringType("2021-12-31"));
    params.addParameter().setName("subject").setValue(new StringType("Patient/testReport01"));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 13 with Subject

use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project cqf-ruler by DBCG.

the class ReportProviderIT method testMissingPeriodEndParam.

@Test
public void testMissingPeriodEndParam() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2021-01-01"));
    params.addParameter().setName("subject").setValue(new StringType("Patient/testReport01"));
    assertThrows(InternalErrorException.class, () -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 14 with Subject

use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project cqf-ruler by DBCG.

the class ReportProviderIT method testPatientSubjectNotFound.

@Test
public void testPatientSubjectNotFound() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2021-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2021-12-31"));
    params.addParameter().setName("subject").setValue(new StringType("Patient/bad-patient"));
    assertThrows(ResourceNotFoundException.class, () -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 15 with Subject

use of org.hl7.fhir.utilities.turtle.Turtle.Subject in project cqf-ruler by DBCG.

the class ReportProviderIT method testSubjectGroup.

// TODO: add the count of patients returned
@Test
public void testSubjectGroup() throws IOException {
    Parameters params = new Parameters();
    params.addParameter().setName("periodStart").setValue(new StringType("2021-01-01"));
    params.addParameter().setName("periodEnd").setValue(new StringType("2021-12-31"));
    params.addParameter().setName("subject").setValue(new StringType("Group/ra-group01"));
    loadResource("Patient-ra-patient01.json");
    loadResource("Group-ra-group01.json");
    assertDoesNotThrow(() -> {
        getClient().operation().onType(MeasureReport.class).named("$report").withParameters(params).returnResourceType(Parameters.class).execute();
    });
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) StringType(org.hl7.fhir.r4.model.StringType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Aggregations

Test (org.junit.Test)124 Test (org.junit.jupiter.api.Test)68 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)64 Bundle (org.hl7.fhir.r4.model.Bundle)56 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)54 Parameters (org.hl7.fhir.r4.model.Parameters)46 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)43 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)42 StringType (org.hl7.fhir.r4.model.StringType)41 IBundleProvider (ca.uhn.fhir.rest.api.server.IBundleProvider)39 Observation (org.hl7.fhir.r4.model.Observation)38 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)37 Bundle (org.hl7.fhir.dstu3.model.Bundle)35 ReferenceParam (ca.uhn.fhir.rest.param.ReferenceParam)32 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)32 ReferenceAndListParam (ca.uhn.fhir.rest.param.ReferenceAndListParam)31 ReferenceOrListParam (ca.uhn.fhir.rest.param.ReferenceOrListParam)31 Patient (org.hl7.fhir.r4.model.Patient)30 SearchParameterMap (org.openmrs.module.fhir2.api.search.param.SearchParameterMap)30 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)29