diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-08-14 14:15:14 +0600 |
---|---|---|
committer | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-08-14 14:15:14 +0600 |
commit | 442579b27ccbac82cb001a5b02402a593d005977 (patch) | |
tree | d11a24bd97d847fd29282fd7bcb79742553d6389 /src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala | |
parent | bfac6a54dcf37e0280cc8f2ec6ff3802dc8e8dfe (diff) | |
download | rest-query-442579b27ccbac82cb001a5b02402a593d005977.tar.gz rest-query-442579b27ccbac82cb001a5b02402a593d005977.tar.bz2 rest-query-442579b27ccbac82cb001a5b02402a593d005977.zip |
PDSUI-2188 Created tests for export and dictionary API
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala')
-rw-r--r-- | src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala new file mode 100644 index 0000000..306fb17 --- /dev/null +++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/HypothesisFormatSuite.scala @@ -0,0 +1,28 @@ +package xyz.driver.pdsuidomain.formats.json.sprayformats + +import spray.json._ +import org.scalatest.{FlatSpec, Matchers} +import xyz.driver.pdsuicommon.domain.UuidId +import xyz.driver.pdsuidomain.entities.Hypothesis + +class HypothesisFormatSuite extends FlatSpec with Matchers { + import hypothesis._ + + "Json format for Hypothesis" should "read and write correct JSON" in { + val hypothesis = Hypothesis( + id = UuidId("3b80b2e2-5372-4cf5-a342-6e4ebe10fafd"), + name = "hypothesis name", + treatmentType = "treatment type", + description = "descr" + ) + val writtenJson = hypothesisFormat.write(hypothesis) + + writtenJson should be( + """{"id":"3b80b2e2-5372-4cf5-a342-6e4ebe10fafd","name":"hypothesis name", + "treatmentType":"treatment type","description":"descr"}""".parseJson) + + val parsedHypothesis = hypothesisFormat.read(writtenJson) + parsedHypothesis should be(hypothesis) + } + +} |