From dfdb1c689615ab79bafa4e904dc61a15db3bbffe Mon Sep 17 00:00:00 2001 From: Kseniya Tomskikh Date: Fri, 10 Nov 2017 20:48:44 +0700 Subject: Fixed calculation of eligibility status with "Unknown" value (instead of NULL) --- .../formats/json/PatientCriterionFormatSuite.scala | 8 ++++---- .../formats/json/PatientEligibleTrialFormatSuite.scala | 4 ++-- .../pdsuidomain/formats/json/PatientLabelFormatSuite.scala | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/test') diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala index e0f96bb..94d80c9 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientCriterionFormatSuite.scala @@ -22,8 +22,8 @@ class PatientCriterionFormatSuite extends FlatSpec with Matchers { criterionText = "criterion text", criterionValue = Some(true), criterionIsDefining = false, - eligibilityStatus = Some(LabelValue.Yes), - verifiedEligibilityStatus = None, + eligibilityStatus = LabelValue.Yes, + verifiedEligibilityStatus = LabelValue.Unknown, isVisible = true, isVerified = true, lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00"), @@ -39,12 +39,12 @@ class PatientCriterionFormatSuite extends FlatSpec with Matchers { writtenJson should be( """{"isVerified":true,"patientLabelId":1,"lastUpdate":"2017-08-10T18:00Z","trialId":0, "armList":[{"patientCriterionId":1,"armId":31,"armName":"arm 31"},{"patientCriterionId":1, - "armId":32,"armName":"arm 32"}],"eligibilityStatus":"Yes","id":1,"nctId":"NCT00001", + "armId":32,"armName":"arm 32"}],"eligibilityStatus":"Yes","verifiedEligibilityStatus":"Unknown","id":1,"nctId":"NCT00001", "criterionId":101,"criterionValue":true,"criterionIsDefining":false,"labelId":21, "isVisible":true,"criterionText":"criterion text","inclusion":true}""".parseJson) val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No"}""".parseJson - val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = Some(LabelValue.No)) + val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = LabelValue.No) val parsedUpdatePatientCriterion = applyUpdateToPatientCriterion(updatePatientCriterionJson, orig) parsedUpdatePatientCriterion should be(expectedUpdatedPatientCriterion) diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala index b5fbf3f..faef0f6 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientEligibleTrialFormatSuite.scala @@ -38,8 +38,8 @@ class PatientEligibleTrialFormatSuite extends FlatSpec with Matchers { patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), trialId = StringId("NCT000001"), hypothesisId = UuidId("e76e2fc4-a29c-44fb-a81b-8856d06bb1d4"), - eligibilityStatus = Some(LabelValue.Yes), - verifiedEligibilityStatus = Some(LabelValue.Yes), + eligibilityStatus = LabelValue.Yes, + verifiedEligibilityStatus = LabelValue.Yes, isVerified = false ) val arms = List( diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala index b83aad1..289de53 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/PatientLabelFormatSuite.scala @@ -17,8 +17,8 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { id = LongId(1), patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), - primaryValue = Some(LabelValue.Yes), - verifiedPrimaryValue = None, + primaryValue = LabelValue.Yes, + verifiedPrimaryValue = LabelValue.Unknown, isVisible = true, score = 1, isImplicitMatch = false @@ -26,11 +26,11 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { val writtenJson = richPatientLabelFormat.write(RichPatientLabel(orig, isVerified = true)) writtenJson should be( - """{"id":1,"labelId":20,"primaryValue":"Yes","isVisible":true,"isVerified":true, + """{"id":1,"labelId":20,"primaryValue":"Yes","isVisible":true,"isVerified":true,"verifiedPrimaryValue":"Unknown", "score":1,"isImplicitMatch":false, "patientId":"748b5884-3528-4cb9-904b-7a8151d6e343"}""".parseJson) val updatePatientLabelJson = """{"verifiedPrimaryValue":"No"}""".parseJson - val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = Some(LabelValue.No)) + val expectedUpdatedPatientLabel = orig.copy(verifiedPrimaryValue = LabelValue.No) val parsedUpdatePatientLabel = applyUpdateToPatientLabel(updatePatientLabelJson, orig) parsedUpdatePatientLabel should be(expectedUpdatedPatientLabel) } @@ -65,8 +65,8 @@ class PatientLabelFormatSuite extends FlatSpec with Matchers { id = LongId(1), patientId = UuidId("748b5884-3528-4cb9-904b-7a8151d6e343"), labelId = LongId(20), - primaryValue = Some(LabelValue.Yes), - verifiedPrimaryValue = Some(LabelValue.Yes), + primaryValue = LabelValue.Yes, + verifiedPrimaryValue = LabelValue.Yes, isVisible = true, score = 1, isImplicitMatch = false -- cgit v1.2.3