diff options
author | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 11:22:11 -0700 |
---|---|---|
committer | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 11:22:11 -0700 |
commit | 05aa114cfd22228f0457b6457ce441af5eabfc60 (patch) | |
tree | 62acecf547f01ca4d69fcd4c7c911e0899e9d96c /src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala | |
parent | 0be360064e7b46eb0ebeac3bfde09d5e80c21d81 (diff) | |
parent | 6751966577c0f005858f372458ccdb72be7d879f (diff) | |
download | rest-query-05aa114cfd22228f0457b6457ce441af5eabfc60.tar.gz rest-query-05aa114cfd22228f0457b6457ce441af5eabfc60.tar.bz2 rest-query-05aa114cfd22228f0457b6457ce441af5eabfc60.zip |
Merge branch 'master' into trial-46-disease-entity
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala')
-rw-r--r-- | src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala index 2999cc1..fbb5213 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala @@ -4,11 +4,12 @@ import spray.json._ import org.scalatest.{FlatSpec, Matchers} import xyz.driver.pdsuicommon.domain.UuidId import xyz.driver.pdsuidomain.entities.PatientHypothesis +import xyz.driver.pdsuidomain.services.PatientHypothesisService.RichPatientHypothesis class PatientHypothesisFormatSuite extends FlatSpec with Matchers { import patienthypothesis._ - "Json format for PatientHypothesis" should "read and write correct JSON" in { + "Json format for RichPatientHypothesis" should "read and write correct JSON" in { val orig = PatientHypothesis( id = UuidId("815d9715-1089-4775-b120-3afb983b9a97"), patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), @@ -16,7 +17,7 @@ class PatientHypothesisFormatSuite extends FlatSpec with Matchers { rationale = None, matchedTrials = 1 ) - val writtenJson = patientHypothesisWriter.write((orig, true)) + val writtenJson = richPatientHypothesisWriter.write(RichPatientHypothesis(orig, isRequired = true)) writtenJson should be ( """{"id":"815d9715-1089-4775-b120-3afb983b9a97","patientId":"748b5884-3528-4cb9-904b-7a8151d6e343", @@ -28,4 +29,19 @@ class PatientHypothesisFormatSuite extends FlatSpec with Matchers { parsedUpdatePatientHypothesis should be(expectedUpdatedPatientHypothesis) } + "Json format for patientHypothesis" should "read and write correct JSON" in { + val orig = PatientHypothesis( + id = UuidId("815d9715-1089-4775-b120-3afb983b9a97"), + patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), + hypothesisId = UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4"), + rationale = None, + matchedTrials = 1 + ) + val writtenJson = patientHypothesisWriter.write(orig) + + writtenJson should be ( + """{"id":"815d9715-1089-4775-b120-3afb983b9a97","patientId":"748b5884-3528-4cb9-904b-7a8151d6e343", + "hypothesisId":"e76e2fc4-a29c-44fb-a81b-8856d06bb1d4","rationale":null,"matchedTrials":1}""".parseJson) + } + } |