aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
diff options
context:
space:
mode:
authorMarvin Bertin <marvin.bertin@gmail.com>2017-10-10 17:17:18 -0700
committerMarvin Bertin <marvin.bertin@gmail.com>2017-10-10 17:17:18 -0700
commitb124608a4faa9cb94474f27c1d4605e5cb0ab63d (patch)
treec3439f756f023facbbae4deea1972ad2f511dda3 /src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
parentf55212361d6126a05075a1f00f3915484b4f334e (diff)
parent385a9a99e5a95c3d623cddd927c37564e32dbd2d (diff)
downloadrest-query-b124608a4faa9cb94474f27c1d4605e5cb0ab63d.tar.gz
rest-query-b124608a4faa9cb94474f27c1d4605e5cb0ab63d.tar.bz2
rest-query-b124608a4faa9cb94474f27c1d4605e5cb0ab63d.zip
fix merge conflictsv0.7.5
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala')
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
index 481e92f..e6dd4a1 100644
--- a/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/DocumentFormatSuite.scala
@@ -24,6 +24,7 @@ class DocumentFormatSuite extends FlatSpec with Matchers {
typeId = Some(LongId(10)),
providerName = Some("provider 21"),
providerTypeId = Some(LongId(21)),
+ institutionName = Some("institution name"),
requiredType = Some(Document.RequiredType.OPN),
meta = None,
startDate = None,
@@ -33,7 +34,7 @@ class DocumentFormatSuite extends FlatSpec with Matchers {
writtenJson should be(
"""{"id":1,"recordId":101,"physician":"physician","typeId":10,"provider":"provider 21","providerTypeId":21,
- "requiredType":"OPN","startDate":null,"endDate":null,"status":"New","assignee":null,"previousStatus":null,
+ "requiredType":"OPN","institutionName":"institution name","startDate":null,"endDate":null,"status":"New","assignee":null,"previousStatus":null,
"previousAssignee":null,"lastActiveUser":null,"lastUpdate":"2017-08-10T18:00Z","meta":null}""".parseJson)
val createDocumentJson =
@@ -41,34 +42,31 @@ class DocumentFormatSuite extends FlatSpec with Matchers {
val expectedCreatedDocument = orig.copy(
id = LongId(0),
lastUpdate = LocalDateTime.MIN,
- requiredType = None
+ requiredType = None,
+ institutionName = None
)
val parsedCreatedDocument = documentFormat.read(createDocumentJson)
parsedCreatedDocument should be(expectedCreatedDocument)
val updateDocumentJson =
- """{"startDate":"2017-08-10","endDate":"2018-08-10","meta":{"predicted":true,"startPage":1.0,"endPage":2.0}}""".parseJson
+ """{"startDate":"2017-08-10","endDate":"2018-08-10","meta":{"startPage":1.0,"endPage":2.0}}""".parseJson
val expectedUpdatedDocument = orig.copy(
startDate = Some(LocalDate.parse("2017-08-10")),
endDate = Some(LocalDate.parse("2018-08-10")),
- meta = Some(TextJson(Document.Meta(predicted = Some(true), startPage = 1.0, endPage = 2.0)))
+ meta = Some(TextJson(Document.Meta(startPage = 1.0, endPage = 2.0)))
)
val parsedUpdatedDocument = applyUpdateToDocument(updateDocumentJson, orig)
parsedUpdatedDocument should be(expectedUpdatedDocument)
}
"Json format for Document.Meta" should "read and write correct JSON" in {
- val meta = Document.Meta(predicted = None, startPage = 1.0, endPage = 2.0)
+ val meta = Document.Meta(startPage = 1.0, endPage = 2.0)
val writtenJson = documentMetaFormat.write(meta)
writtenJson should be("""{"startPage":1.0,"endPage":2.0}""".parseJson)
- val metaJsonWithoutPredicted = """{"startPage":1.0,"endPage":2.0}""".parseJson
- val parsedMetaWithoutPredicted = documentMetaFormat.read(metaJsonWithoutPredicted)
- parsedMetaWithoutPredicted should be(meta)
-
- val metaJsonWithPredicted = """{"predicted":true,"startPage":1.0,"endPage":2.0}""".parseJson
- val parsedMetaWithPredicted = documentMetaFormat.read(metaJsonWithPredicted)
- parsedMetaWithPredicted should be(meta.copy(predicted = Some(true)))
+ val metaJson = """{"startPage":1.0,"endPage":2.0}""".parseJson
+ val parsedMeta = documentMetaFormat.read(metaJson)
+ parsedMeta should be(meta)
}
}