diff options
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json')
4 files changed, 15 insertions, 14 deletions
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 diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala index c17327b..7f4f169 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/TrialHistoryFormatSuite.scala @@ -17,12 +17,13 @@ class TrialHistoryFormatSuite extends FlatSpec with Matchers { executor = xyz.driver.core.Id("userId-001"), state = TrialHistory.State.Summarize, action = TrialHistory.Action.Start, - created = LocalDateTime.parse("2017-08-10T18:00:00") + created = LocalDateTime.parse("2017-08-10T18:00:00"), + comment = Option("Yolo!") ) val writtenJson = trialHistoryFormat.write(trialHistory) writtenJson should be("""{"id":10,"executor":"userId-001","trialId":"NCT000001","state":"Summarize", - "action":"Start","created":"2017-08-10T18:00Z"}""".parseJson) + "action":"Start","created":"2017-08-10T18:00Z", "comment": "Yolo!"}""".parseJson) val parsedTrialHistory = trialHistoryFormat.read(writtenJson) parsedTrialHistory should be(trialHistory) |