From 7446fbcb6f51ae67ae8bf0f54729e774da8e7f73 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Wed, 4 Oct 2017 16:23:04 +0700 Subject: Implemented new spray json formats for PatientHypothesis and PatientLabel --- .../sprayformats/PatientLabelFormatSuite.scala | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala') 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( -- cgit v1.2.3