From 15d74838eb592c58bb0a912380f0ec1f537be333 Mon Sep 17 00:00:00 2001 From: Kseniya Tomskikh Date: Wed, 18 Oct 2017 13:51:47 +0700 Subject: TRIAL-54 Study designs as enum --- .../formats/json/sprayformats/InterventionFormatSuite.scala | 2 +- .../formats/json/sprayformats/StudyDesignFormatSuite.scala | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/test/scala') 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 5891e1c..a118093 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 @@ -59,7 +59,7 @@ class InterventionFormatSuite extends FlatSpec with Matchers { } "Json format for InterventionType" should "read and write correct JSON" in { - val interventionType = InterventionType.typeFromString("Surgery/Procedure") + val interventionType = InterventionType.typeFromString("Surgery/Procedure").get val writtenJson = interventionTypeFormat.write(interventionType) writtenJson should be( diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/StudyDesignFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/StudyDesignFormatSuite.scala index 9cf9b5f..e847445 100644 --- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/StudyDesignFormatSuite.scala +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/StudyDesignFormatSuite.scala @@ -2,20 +2,16 @@ package xyz.driver.pdsuidomain.formats.json.sprayformats import spray.json._ import org.scalatest.{FlatSpec, Matchers} -import xyz.driver.pdsuicommon.domain.LongId import xyz.driver.pdsuidomain.entities.StudyDesign class StudyDesignFormatSuite extends FlatSpec with Matchers { import studydesign._ "Json format for StudyDesign" should "read and write correct JSON" in { - val studyDesign = StudyDesign( - id = LongId(10), - name = "study design name" - ) + val studyDesign = StudyDesign.Randomized val writtenJson = studyDesignFormat.write(studyDesign) - writtenJson should be("""{"id":10,"name":"study design name"}""".parseJson) + writtenJson should be("""{"id":1,"name":"Randomized"}""".parseJson) val parsedStudyDesign = studyDesignFormat.read(writtenJson) parsedStudyDesign should be(studyDesign) -- cgit v1.2.3