aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-10-30 16:29:46 +0700
committerGitHub <noreply@github.com>2017-10-30 16:29:46 +0700
commit604fbf0a7a082bc440c0778abd6f90005b210c16 (patch)
treefd846d42448b2d3f432056898f0c3433475ea0da /src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala
parent8811d60442d060097027b33784ece9a704458e1d (diff)
parentd92a2795a02b9711aa9aed92a770f85377b31460 (diff)
downloadrest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.tar.gz
rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.tar.bz2
rest-query-604fbf0a7a082bc440c0778abd6f90005b210c16.zip
Merge pull request #54 from drivergroup/PDSUI-2336v0.11.0
PDSUI-2336 Cleanup
Diffstat (limited to 'src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala')
-rw-r--r--src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala b/src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala
new file mode 100644
index 0000000..9aaecae
--- /dev/null
+++ b/src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala
@@ -0,0 +1,32 @@
+package xyz.driver.pdsuidomain.formats.json
+
+import java.time.LocalDateTime
+
+import spray.json._
+import org.scalatest.{FlatSpec, Matchers}
+import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue
+
+class BridgeUploadQueueFormatSuite extends FlatSpec with Matchers {
+ import xyz.driver.pdsuidomain.formats.json.bridgeuploadqueue._
+
+ "Json format for BridgeUploadQueue.Item" should "read and write correct JSON" in {
+ val item = BridgeUploadQueue.Item(
+ kind = "kind",
+ tag = "tag",
+ created = LocalDateTime.parse("2017-08-10T18:00:00"),
+ attempts = 0,
+ nextAttempt = LocalDateTime.parse("2017-08-10T18:10:00"),
+ completed = false,
+ dependencyKind = Some("dependency king"),
+ dependencyTag = None
+ )
+ val writtenJson = queueUploadItemFormat.write(item)
+
+ writtenJson should be(
+ """{"kind":"kind","tag":"tag","created":"2017-08-10T18:00Z","attempts":0,"nextAttempt":"2017-08-10T18:10Z","completed":false}""".parseJson)
+
+ val parsedItem = queueUploadItemFormat.read(writtenJson)
+ parsedItem should be(item.copy(dependencyKind = None, completed = true))
+ }
+
+}