diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-20 16:25:04 +0700 |
---|---|---|
committer | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-20 16:25:04 +0700 |
commit | 54b15dae509212f6661dc1f1bc4ca248cb487443 (patch) | |
tree | 85b1ceafd9a56da511513797bd263977f52b556c /src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala | |
parent | 6d6e732368e97e319653f00e498189afceeb4671 (diff) | |
download | rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.tar.gz rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.tar.bz2 rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.zip |
PDSUI-2336 Deleted api classes of play format, userhistory and message services
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala')
-rw-r--r-- | src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala deleted file mode 100644 index b254013..0000000 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/PatientCriterionFormatSuite.scala +++ /dev/null @@ -1,58 +0,0 @@ -package xyz.driver.pdsuidomain.formats.json.sprayformats - -import java.time.LocalDateTime - -import spray.json._ -import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.entities.labels.LabelValue -import xyz.driver.pdsuicommon.domain.{LongId, StringId} -import xyz.driver.pdsuidomain.entities.{PatientCriterion, PatientCriterionArm} -import xyz.driver.pdsuidomain.services.PatientCriterionService.{DraftPatientCriterion, RichPatientCriterion} - -class PatientCriterionFormatSuite extends FlatSpec with Matchers { - import patientcriterion._ - - "Json format for PatientCriterion" should "read and write correct JSON" in { - val orig = PatientCriterion( - id = LongId(1), - patientLabelId = LongId(1), - trialId = 0L, - nctId = StringId("NCT00001"), - criterionId = LongId(101), - criterionText = "criterion text", - criterionValue = Some(true), - criterionIsDefining = false, - eligibilityStatus = Some(LabelValue.Yes), - verifiedEligibilityStatus = None, - isVisible = true, - isVerified = true, - lastUpdate = LocalDateTime.parse("2017-08-10T18:00:00") - ) - val arms = List( - PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(31), armName = "arm 31"), - PatientCriterionArm(patientCriterionId = LongId(1), armId = LongId(32), armName = "arm 32") - ) - val richPatientCriterion = RichPatientCriterion(orig, LongId(21), arms) - val writtenJson = patientCriterionWriter.write(richPatientCriterion) - - writtenJson should be( - """{"id":1,"labelId":21,"nctId":"NCT00001","criterionId":101,"criterionText":"criterion text","criterionValue":"Yes", - "criterionIsDefining":false,"criterionIsCompound":false,"eligibilityStatus":"Yes","verifiedEligibilityStatus":null, - "isVisible":true,"isVerified":true,"lastUpdate":"2017-08-10T18:00Z","arms":["arm 31","arm 32"]}""".parseJson) - - val updatePatientCriterionJson = """{"verifiedEligibilityStatus":"No"}""".parseJson - val expectedUpdatedPatientCriterion = orig.copy(verifiedEligibilityStatus = Some(LabelValue.No)) - val parsedUpdatePatientCriterion = applyUpdateToPatientCriterion(updatePatientCriterionJson, orig) - parsedUpdatePatientCriterion should be(expectedUpdatedPatientCriterion) - - val updateBulkPatientCriterionJson = - """[{"id":1,"eligibilityStatus":"No"},{"id":2,"isVerified":false}]""".parseJson - val expectedDraftPatientCriterionList = List( - DraftPatientCriterion(id = LongId(1), eligibilityStatus = Some(LabelValue.No), isVerified = None), - DraftPatientCriterion(id = LongId(2), eligibilityStatus = None, isVerified = Some(false)) - ) - val parsedDraftPatientCriterionList = draftPatientCriterionListReader.read(updateBulkPatientCriterionJson) - parsedDraftPatientCriterionList should be(expectedDraftPatientCriterionList) - } - -} |