Search in sources :

Example 11 with GENERATED

use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.

the class MedicationNarrativeTest method shouldGenerateMedicationNarrative.

/**
 * Check that the expected narrative is generated for some example Medication resource
 *
 * @throws IOException
 */
@Test
public void shouldGenerateMedicationNarrative() throws IOException {
    Medication given = parser.parseResource(Medication.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
    Medication result = parser.parseResource(Medication.class, parser.encodeResourceToString(given));
    assertThat(result, notNullValue());
    assertThat(result.getText(), notNullValue());
    assertThat(result.getText().getStatusAsString(), equalTo("generated"));
    assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
Also used : Medication(org.hl7.fhir.r4.model.Medication) Test(org.junit.Test)

Example 12 with GENERATED

use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.

the class MedicationRequestNarrativeTest method shouldGenerateMedicationRequestNarrative.

/**
 * Check that the expected narrative is generated for some example MedicationRequest resource
 *
 * @throws IOException
 */
@Test
public void shouldGenerateMedicationRequestNarrative() throws IOException {
    MedicationRequest given = parser.parseResource(MedicationRequest.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
    MedicationRequest result = parser.parseResource(MedicationRequest.class, parser.encodeResourceToString(given));
    assertThat(result, notNullValue());
    assertThat(result.getText(), notNullValue());
    assertThat(result.getText().getStatusAsString(), equalTo("generated"));
    assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
Also used : MedicationRequest(org.hl7.fhir.r4.model.MedicationRequest) Test(org.junit.Test)

Example 13 with GENERATED

use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.

the class ObservationNarrativeTest method shouldGenerateObservationNarrative.

/**
 * Check that the expected narrative is generated for some example Observation resource
 *
 * @throws IOException
 */
@Test
public void shouldGenerateObservationNarrative() throws IOException {
    Observation given = parser.parseResource(Observation.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
    Observation result = parser.parseResource(Observation.class, parser.encodeResourceToString(given));
    assertThat(result, notNullValue());
    assertThat(result.getText(), notNullValue());
    assertThat(result.getText().getStatusAsString(), equalTo("generated"));
    assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
Also used : Observation(org.hl7.fhir.r4.model.Observation) Test(org.junit.Test)

Example 14 with GENERATED

use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.

the class PersonNarrativeTest method shouldGeneratePersonNarrative.

/**
 * Check that the expected narrative is generated for some example Person resource
 *
 * @throws IOException
 */
@Test
public void shouldGeneratePersonNarrative() throws IOException {
    Person given = parser.parseResource(Person.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
    Person result = parser.parseResource(Person.class, parser.encodeResourceToString(given));
    assertThat(result, notNullValue());
    assertThat(result.getText(), notNullValue());
    assertThat(result.getText().getStatusAsString(), equalTo("generated"));
    assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
Also used : Person(org.hl7.fhir.r4.model.Person) Test(org.junit.Test)

Example 15 with GENERATED

use of org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED in project openmrs-module-fhir2 by openmrs.

the class PractitionerNarrativeTest method shouldGeneratePractitionerNarrative.

/**
 * Check that the expected narrative is generated for some example Practitioner resource
 *
 * @throws IOException
 */
@Test
public void shouldGeneratePractitionerNarrative() throws IOException {
    Practitioner given = parser.parseResource(Practitioner.class, getClass().getClassLoader().getResourceAsStream(EXAMPLE_RESOURCE_PATH));
    Practitioner result = parser.parseResource(Practitioner.class, parser.encodeResourceToString(given));
    assertThat(result, notNullValue());
    assertThat(result.getText(), notNullValue());
    assertThat(result.getText().getStatusAsString(), equalTo("generated"));
    assertThat(result.getText().getDivAsString(), equalTo(readNarrativeFile(EXPECTED_NARRATIVE_PATH)));
}
Also used : Practitioner(org.hl7.fhir.r4.model.Practitioner) Test(org.junit.Test)

Aggregations

XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)37 FHIRException (org.hl7.fhir.exceptions.FHIRException)28 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)24 IOException (java.io.IOException)22 NotImplementedException (org.apache.commons.lang3.NotImplementedException)19 Test (org.junit.Test)18 UnsupportedEncodingException (java.io.UnsupportedEncodingException)14 FileOutputStream (java.io.FileOutputStream)8 ItemComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent)8 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)8 ParseException (java.text.ParseException)7 BigDecimal (java.math.BigDecimal)6 Narrative (org.hl7.fhir.dstu3.model.Narrative)6 TerminologyServiceException (org.hl7.fhir.exceptions.TerminologyServiceException)6 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)6 XhtmlComposer (org.hl7.fhir.utilities.xhtml.XhtmlComposer)6 HashMap (java.util.HashMap)5 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)5 OutputStreamWriter (java.io.OutputStreamWriter)4 ArrayList (java.util.ArrayList)4