aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/pdsuidomain
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2017-10-04 16:23:04 +0700
committerAleksandr <ognelisar@gmail.com>2017-10-04 16:23:04 +0700
commit7446fbcb6f51ae67ae8bf0f54729e774da8e7f73 (patch)
tree667c0f62d13561732096c2c9b251e3a227abfbe0 /src/test/scala/xyz/driver/pdsuidomain
parent996af2657cdd779e08e46fc1ba5f47d9e7c5aac5 (diff)
downloadrest-query-7446fbcb6f51ae67ae8bf0f54729e774da8e7f73.tar.gz
rest-query-7446fbcb6f51ae67ae8bf0f54729e774da8e7f73.tar.bz2
rest-query-7446fbcb6f51ae67ae8bf0f54729e774da8e7f73.zip
Implemented new spray json formats for PatientHypothesis and PatientLabel
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain')
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientHypothesisFormatSuite.scala19
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala24
2 files changed, 39 insertions, 4 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 1a5b7eb..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
@@ -9,7 +9,7 @@ import xyz.driver.pdsuidomain.services.PatientHypothesisService.RichPatientHypot
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"),
@@ -17,7 +17,7 @@ class PatientHypothesisFormatSuite extends FlatSpec with Matchers {
rationale = None,
matchedTrials = 1
)
- val writtenJson = patientHypothesisWriter.write(RichPatientHypothesis(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",
@@ -29,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)
+ }
+
}
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
index 8b7c138..ffb1bd4 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
@@ -10,7 +10,7 @@ import xyz.driver.pdsuidomain.services.PatientLabelService.RichPatientLabel
class PatientLabelFormatSuite extends FlatSpec with Matchers {
- "Json format for PatientLabel" should "read and write correct JSON" in {
+ "Json format for RichPatientLabel" should "read and write correct JSON" in {
import patientlabel._
val orig = PatientLabel(
id = LongId(1),
@@ -22,7 +22,7 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
score = 1,
isImplicitMatch = false
)
- val writtenJson = patientLabelWriter.write(RichPatientLabel(orig, true))
+ val writtenJson = richPatientLabelWriter.write(RichPatientLabel(orig, isVerified = true))
writtenJson should be (
"""{"id":1,"labelId":20,"primaryValue":"Yes","verifiedPrimaryValue":null,"isVisible":true,"isVerified":true,
@@ -34,6 +34,26 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel)
}
+ "Json format for PatientLabel" should "read and write correct JSON" in {
+ import patientlabel._
+ val orig = PatientLabel(
+ id = LongId(1),
+ patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"),
+ labelId = LongId(20),
+ primaryValue = Some(FuzzyValue.Yes),
+ verifiedPrimaryValue = None,
+ isVisible = true,
+ score = 1,
+ isImplicitMatch = false
+ )
+ val writtenJson = patientLabelWriter.write(orig)
+
+ writtenJson should be (
+ """{"id":1,"labelId":20,"primaryValue":"Yes","verifiedPrimaryValue":null,"isVisible":true,
+ "score":1,"isImplicitMatch":false}""".parseJson)
+ }
+
+
"Json format for PatientLabelEvidence" should "read and write correct JSON" in {
import patientlabel._
val orig = PatientLabelEvidenceView(