Search in sources :

Example 71 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class ConceptMapElementTest method serialize.

@Test
public void serialize() throws Exception {
    printPrettyJson(element);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(element));
    assertThat(jsonPath.getString("code"), equalTo("Code"));
    assertThat(jsonPath.getString("display"), equalTo("Display"));
    assertThat(jsonPath.get("target.equivalence"), hasItem("Equivalence"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 72 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class ConceptMapElementTest method serializeWithMissingOptionalFields.

@Test
public void serializeWithMissingOptionalFields() throws Exception {
    ConceptMapElement element = ConceptMapElement.builder().build();
    JsonPath jsonPath = getJsonPath(element);
    assertNull(jsonPath.get("code"));
    assertNull(jsonPath.get("display"));
    assertNull(jsonPath.get("target"));
    assertNull(jsonPath.get("target"));
}
Also used : ConceptMapElement(com.b2international.snowowl.fhir.core.model.conceptmap.ConceptMapElement) JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 73 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class CapabilityStatementTest method serialize.

@Test
public void serialize() throws Exception {
    printPrettyJson(capabilityStatement);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(capabilityStatement));
    assertThat(jsonPath.getString("id"), equalTo("id"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 74 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class OperationOutcomeTest method serialize.

@Test
public void serialize() throws JsonProcessingException {
    OperationOutcome operationOutcome = OperationOutcome.builder().addIssue(Issue.builder().severity(IssueSeverity.ERROR).code(IssueType.REQUIRED).addLocation("location").build()).build();
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(operationOutcome));
    assertThat(jsonPath.getString("resourceType"), equalTo("OperationOutcome"));
    jsonPath.setRoot("issue[0]");
    assertThat(jsonPath.getString("severity"), equalTo("error"));
    assertThat(jsonPath.getString("code"), equalTo("required"));
    assertThat(jsonPath.getList("location"), equalTo(Lists.newArrayList("location")));
}
Also used : OperationOutcome(com.b2international.snowowl.fhir.core.model.OperationOutcome) JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 75 with JsonPath

use of io.restassured.path.json.JsonPath in project snow-owl by b2ihealthcare.

the class RangeUsageContextTest method serialize.

@Test
public void serialize() throws Exception {
    printPrettyJson(usageContext);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(usageContext));
    assertThat(jsonPath.getString("id"), equalTo("usageContextId"));
    assertThat(jsonPath.getString("valueRange.low.id"), equalTo("id"));
    assertThat(jsonPath.getDouble("valueRange.low.value"), equalTo(1.0));
    assertThat(jsonPath.getString("valueRange.low.unit"), equalTo("ms"));
    assertThat(jsonPath.getString("valueRange.low.code"), equalTo("1"));
    assertThat(jsonPath.getString("valueRange.high.id"), equalTo("id2"));
    assertThat(jsonPath.getDouble("valueRange.high.value"), equalTo(10.0));
    assertThat(jsonPath.getString("valueRange.high.unit"), equalTo("ms"));
    assertThat(jsonPath.getString("valueRange.high.code"), equalTo("10"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

JsonPath (io.restassured.path.json.JsonPath)117 Test (org.junit.Test)101 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)82 Response (io.restassured.response.Response)9 Fhir (com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir)8 Date (java.util.Date)6 Property (com.b2international.snowowl.fhir.core.model.codesystem.Property)4 Coding (com.b2international.snowowl.fhir.core.model.dt.Coding)4 SubProperty (com.b2international.snowowl.fhir.core.model.dt.SubProperty)4 CodeSystem (com.b2international.snowowl.fhir.core.model.codesystem.CodeSystem)3 Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)3 HashMap (java.util.HashMap)3 TranslateResult (com.b2international.snowowl.fhir.core.model.conceptmap.TranslateResult)2 BigDecimal (java.math.BigDecimal)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 AbstractIntegrationTest (org.codice.ddf.itests.common.AbstractIntegrationTest)2 MappingJackson2HttpMessageConverter (org.springframework.http.converter.json.MappingJackson2HttpMessageConverter)2 MockMvc (org.springframework.test.web.servlet.MockMvc)2 OperationOutcomeCode (com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode)1