aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala
diff options
context:
space:
mode:
authorMarvin Bertin <marvin.bertin@gmail.com>2017-10-03 13:08:00 -0700
committerMarvin Bertin <marvin.bertin@gmail.com>2017-10-03 13:08:00 -0700
commit0653b90dddc294fddb0e81059aef00b202113d78 (patch)
tree3d8abb424b0f0495f1cbb18849184dd20d6897fc /src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala
parent5750f2f3633e75f2f96d6a36264ab4b8f3fec7d2 (diff)
parenta321a978353439fc516b0f2016c28fb32ba1b7ae (diff)
downloadrest-query-0653b90dddc294fddb0e81059aef00b202113d78.tar.gz
rest-query-0653b90dddc294fddb0e81059aef00b202113d78.tar.bz2
rest-query-0653b90dddc294fddb0e81059aef00b202113d78.zip
Merge branch 'master' into add-slot-eligibility-arms
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala')
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala
index 9601834..51665d2 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/CriterionFormatSuite.scala
@@ -15,7 +15,8 @@ class CriterionFormatSuite extends FlatSpec with Matchers {
trialId = StringId("NCT000001"),
text = Some("text"),
isCompound = false,
- meta = "{}"
+ meta = "{}",
+ inclusion = None
)
val labels = List(
CriterionLabel(
@@ -44,12 +45,12 @@ class CriterionFormatSuite extends FlatSpec with Matchers {
val writtenJson = richCriterionFormat.write(richCriterion)
writtenJson should be(
- """{"text":"text","isCompound":false,"trialId":"NCT000001","arms":[20,21,21],"id":10,"meta":"{}",
+ """{"text":"text","isCompound":false,"trialId":"NCT000001","inclusion":null,"arms":[20,21,21],"id":10,"meta":"{}",
"labels":[{"labelId":101,"categoryId":3,"value":"Yes","isDefining":true},
{"labelId":102,"categoryId":3,"value":"No","isDefining":true}]}""".parseJson)
val createCriterionJson =
- """{"text":"text","isCompound":false,"trialId":"NCT000001",
+ """{"text":"text","isCompound":false,"trialId":"NCT000001","inclusion":null,
"arms":[20,21,21],"meta":"{}","labels":[{"labelId":101,"categoryId":3,"value":"Yes","isDefining":true},
{"labelId":102,"categoryId":3,"value":"No","isDefining":true}]}""".parseJson
val parsedRichCriterion = richCriterionFormat.read(createCriterionJson)
@@ -59,8 +60,14 @@ class CriterionFormatSuite extends FlatSpec with Matchers {
)
parsedRichCriterion should be(expectedRichCriterion)
- val updateCriterionJson = """{"meta":null,"text":"new text","isCompound":true}""".parseJson
- val expectedUpdatedCriterion = richCriterion.copy(criterion = criterion.copy(text = Some("new text"), isCompound = true, meta = "{}"))
+ val updateCriterionJson = """{"meta":null,"text":"new text","isCompound":true,"inclusion":true}""".parseJson
+ val expectedUpdatedCriterion = richCriterion.copy(
+ criterion = criterion.copy(
+ text = Some("new text"),
+ isCompound = true,
+ meta = "{}",
+ inclusion = Some(true)
+ ))
val parsedUpdateCriterion = applyUpdateToCriterion(updateCriterionJson, richCriterion)
parsedUpdateCriterion should be(expectedUpdatedCriterion)
}