Search in sources :

Example 16 with JsonPath

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

the class ExtensionTest method serialize.

@Test
public void serialize() throws Exception {
    Extension<Integer> extension = IntegerExtension.builder().url("ID").value(1).build();
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(extension));
    assertThat(jsonPath.getString("url"), equalTo("ID"));
    assertThat(jsonPath.getInt("valueInteger"), equalTo(1));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 17 with JsonPath

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

the class CodeSystemTest method serializeMinimalCodeSystem.

@Test
public void serializeMinimalCodeSystem() throws Exception {
    CodeSystem codeSystem = CodeSystem.builder().status(PublicationStatus.ACTIVE).content(CodeSystemContentMode.COMPLETE).build();
    applyFilter(codeSystem);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(codeSystem));
    assertThat(jsonPath.getString("resourceType"), equalTo("CodeSystem"));
    assertThat(jsonPath.getString("status"), equalTo("active"));
    assertThat(jsonPath.getString("content"), equalTo("complete"));
    String expectedJson = "{\"resourceType\":\"CodeSystem\"," + "\"status\":\"active\"," + "\"content\":\"complete\"}";
    assertEquals(expectedJson, objectMapper.writeValueAsString(codeSystem));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) CodeSystem(com.b2international.snowowl.fhir.core.model.codesystem.CodeSystem) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 18 with JsonPath

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

the class ConceptTest method serialize.

@Test
public void serialize() throws Exception {
    printPrettyJson(concept);
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(concept));
    assertThat(jsonPath.getString("code"), equalTo("conceptCode"));
    assertThat(jsonPath.getString("display"), equalTo("Label"));
    assertThat(jsonPath.getString("definition"), equalTo("Definition"));
    assertThat(jsonPath.getString("designation[0].language"), equalTo("uk_en"));
    assertThat(jsonPath.getString("designation[0].use.code"), equalTo("internal"));
    assertThat(jsonPath.getString("property[0].code"), equalTo("childConcept"));
}
Also used : JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 19 with JsonPath

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

the class IssueTest method serialize.

@Test
public void serialize() throws Exception {
    Issue issue = Issue.builder().severity(IssueSeverity.ERROR).code(IssueType.REQUIRED).addExpression("Issue expression").addLocation("Issue location").details(CodeableConcept.builder().addCoding(Coding.builder().code("A").display("A display").build()).text("Text").build()).build();
    JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(issue));
    assertThat(jsonPath.getString("severity"), equalTo("error"));
    assertThat(jsonPath.getString("code"), equalTo("required"));
    assertThat(jsonPath.getList("expression"), equalTo(Lists.newArrayList("Issue expression")));
    assertThat(jsonPath.getList("location"), equalTo(Lists.newArrayList("Issue location")));
    jsonPath.setRoot("details");
    assertThat(jsonPath.getString("text"), equalTo("Text"));
    jsonPath.setRoot("details.coding[0]");
    assertThat(jsonPath.getString("code"), equalTo("A"));
    assertThat(jsonPath.getString("display"), equalTo("A display"));
}
Also used : Issue(com.b2international.snowowl.fhir.core.model.Issue) JsonPath(io.restassured.path.json.JsonPath) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 20 with JsonPath

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

the class QuantityUsageContextTest 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("code.code"), equalTo("coding"));
    assertThat(jsonPath.getString("code.display"), equalTo("codingDisplay"));
    assertThat(jsonPath.getString("valueQuantity.value"), equalTo("1.0"));
    assertThat(jsonPath.getString("valueQuantity.comparator"), equalTo(">"));
    assertThat(jsonPath.getString("valueQuantity.unit"), equalTo("ms"));
    assertThat(jsonPath.getString("valueQuantity.code"), equalTo("valueCode"));
}
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