aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
diff options
context:
space:
mode:
authorMarvin Bertin <marvin.bertin@gmail.com>2017-10-10 11:54:20 -0700
committerMarvin Bertin <marvin.bertin@gmail.com>2017-10-10 11:54:20 -0700
commit19a70318ecee81872fffe23c03d83e725610911d (patch)
tree984510310c95856fcdcb463d9a242f9773795266 /src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientLabelFormatSuite.scala
parent05aa114cfd22228f0457b6457ce441af5eabfc60 (diff)
parent4f83461cba1f78e607ca2a4edb6fa26f6e16e732 (diff)
downloadrest-query-19a70318ecee81872fffe23c03d83e725610911d.tar.gz
rest-query-19a70318ecee81872fffe23c03d83e725610911d.tar.bz2
rest-query-19a70318ecee81872fffe23c03d83e725610911d.zip
fix merge conflicts with master
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.scala32
1 files changed, 17 insertions, 15 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 3ef286d..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,8 +4,9 @@ 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 {
@@ -16,7 +17,7 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
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,
@@ -24,13 +25,13 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers {
)
val writtenJson = richPatientLabelWriter.write(RichPatientLabel(orig, isVerified = true))
- writtenJson should be (
+ 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 parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig)
+ val updatePatientLabelJson = """{"verifiedPrimaryValue":"No"}""".parseJson
+ val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(LabelValue.No))
+ val parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig)
parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel)
}
@@ -38,23 +39,24 @@ 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
)
val writtenJson = patientLabelEvidenceWriter.write(orig)
- writtenJson should be (
+ 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 {
@@ -63,15 +65,15 @@ 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
)
val writtenJson = patientLabelDefiningCriteriaWriter.write(orig)
- writtenJson should be ("""{"id":1,"value":"Yes"}""".parseJson)
+ writtenJson should be("""{"id":1,"value":"Yes"}""".parseJson)
}
}