aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/pdsuidomain/formats/json
diff options
context:
space:
mode:
authortimgushue <tim@driver.xyz>2017-09-27 09:34:45 -0700
committertimgushue <tim@driver.xyz>2017-09-27 09:34:45 -0700
commite9d3e19f637614809aab39d9df2d1fcc6c78916e (patch)
tree29560b9b5bfb1b235c6429506f56fa9dab8d4510 /src/test/scala/xyz/driver/pdsuidomain/formats/json
parent0ef0059e9b47430e52d6bad4ced5b1be7f3b1a0d (diff)
parentc24679f1ae7d7ccc4e6693535b0aa3ac0e1ca225 (diff)
downloadrest-query-e9d3e19f637614809aab39d9df2d1fcc6c78916e.tar.gz
rest-query-e9d3e19f637614809aab39d9df2d1fcc6c78916e.tar.bz2
rest-query-e9d3e19f637614809aab39d9df2d1fcc6c78916e.zip
Merge branch 'master' into add-slot-eligibility-arms
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json')
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/InterventionFormatSuite.scala16
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)