diff options
author | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 17:17:18 -0700 |
---|---|---|
committer | Marvin Bertin <marvin.bertin@gmail.com> | 2017-10-10 17:17:18 -0700 |
commit | b124608a4faa9cb94474f27c1d4605e5cb0ab63d (patch) | |
tree | c3439f756f023facbbae4deea1972ad2f511dda3 /src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala | |
parent | f55212361d6126a05075a1f00f3915484b4f334e (diff) | |
parent | 385a9a99e5a95c3d623cddd927c37564e32dbd2d (diff) | |
download | rest-query-b124608a4faa9cb94474f27c1d4605e5cb0ab63d.tar.gz rest-query-b124608a4faa9cb94474f27c1d4605e5cb0ab63d.tar.bz2 rest-query-b124608a4faa9cb94474f27c1d4605e5cb0ab63d.zip |
fix merge conflictsv0.7.5
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala')
-rw-r--r-- | src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala | 27 |
1 files changed, 15 insertions, 12 deletions
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 67d678c..2122777 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 @@ -4,31 +4,33 @@ import java.time.LocalDate import spray.json._ import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, UuidId} -import xyz.driver.pdsuidomain.entities.{PatientLabel, PatientLabelEvidenceView} +import xyz.driver.entities.labels.LabelValue +import xyz.driver.pdsuicommon.domain.{LongId, UuidId} +import xyz.driver.pdsuidomain.entities._ +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), patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), - primaryValue = Some(FuzzyValue.Yes), + primaryValue = Some(LabelValue.Yes), verifiedPrimaryValue = None, isVisible = true, score = 1, isImplicitMatch = false ) - val writtenJson = patientLabelWriter.write((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, "score":1,"isImplicitMatch":false}""".parseJson) val updatePatientLabelJson = """{"verifiedPrimaryValue":"No"}""".parseJson - val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(FuzzyValue.No)) + val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(LabelValue.No)) val parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig) parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel) } @@ -37,14 +39,14 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { import patientlabel._ val orig = PatientLabelEvidenceView( id = LongId(1), - value = FuzzyValue.Maybe, + value = LabelValue.Maybe, evidenceText = "evidence text", documentId = Some(LongId(21)), evidenceId = Some(LongId(10)), reportId = None, - documentType = "document type", + documentType = DocumentType.LaboratoryReport, date = Some(LocalDate.parse("2017-08-10")), - providerType = "provider type", + providerType = ProviderType.EmergencyMedicine, patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), isImplicitMatch = false @@ -53,7 +55,8 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { writtenJson should be( """{"id":1,"value":"Maybe","evidenceText":"evidence text","documentId":21,"evidenceId":10,"reportId":null, - "documentType":"document type","date":"2017-08-10","providerType":"provider type"}""".parseJson) + "documentType":{"id":3,"name":"Laboratory Report"},"date":"2017-08-10", + "providerType":{"id":26,"name":"Emergency Medicine"}}""".parseJson) } "Json format for PatientLabelDefiningCriteria" should "read and write correct JSON" in { @@ -62,8 +65,8 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { id = LongId(1), patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), - primaryValue = Some(FuzzyValue.Yes), - verifiedPrimaryValue = Some(FuzzyValue.Yes), + primaryValue = Some(LabelValue.Yes), + verifiedPrimaryValue = Some(LabelValue.Yes), isVisible = true, score = 1, isImplicitMatch = false |