diff options
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats')
-rw-r--r-- | src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala index a52c385..dad39c8 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala @@ -18,7 +18,8 @@ class InterventionFormatSuite extends FlatSpec with Matchers { originalType = Some("orig type"), dosage = "", originalDosage = "", - isActive = true + isActive = true, + deliveryMethod = Some("pill") ) val arms = List( InterventionArm(interventionId = intervention.id, armId = LongId(20)), @@ -33,11 +34,11 @@ class InterventionFormatSuite extends FlatSpec with Matchers { writtenJson should be( """{"id":1,"name":"intervention name","typeId":10,"dosage":"","isActive":true,"arms":[20,21,22], - "trialId":"NCT000001","originalName":"orig name","originalDosage":"","originalType":"orig type"}""".parseJson) + "trialId":"NCT000001","deliveryMethod":"pill","originalName":"orig name","originalDosage":"","originalType":"orig type"}""".parseJson) val createInterventionJson = """{"id":1,"name":"intervention name","typeId":10,"dosage":"","isActive":true,"arms":[20,21,22], - "trialId":"NCT000001"}""".parseJson + "trialId":"NCT000001","deliveryMethod":"pill"}""".parseJson val parsedCreateIntervention = interventionFormat.read(createInterventionJson) val expectedCreateIntervention = parsedCreateIntervention.copy( intervention = intervention.copy(id = LongId(0), originalType = None, originalName = "intervention name"), @@ -58,13 +59,12 @@ class InterventionFormatSuite extends FlatSpec with Matchers { } "Json format for InterventionType" should "read and write correct JSON" in { - val interventionType = InterventionType( - id = LongId(10), - name = "type name" - ) + val interventionType = InterventionType.typeFromString("Surgery/Procedure") val writtenJson = interventionTypeFormat.write(interventionType) - writtenJson should be("""{"id":10,"name":"type name"}""".parseJson) + writtenJson should be( + """{"id":9,"name":"Surgery/Procedure","deliveryMethods":["Radio-Frequency Ablation (RFA)", + "Cryoablation","Therapeutic Conventional Surgery","Robotic Assisted Laparoscopic Surgery"]}""".parseJson) val parsedInterventionType = interventionTypeFormat.read(writtenJson) parsedInterventionType should be(interventionType) |