diff options
author | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-20 16:25:04 +0700 |
---|---|---|
committer | Kseniya Tomskikh <ktomskih@datamonsters.co> | 2017-10-20 16:25:04 +0700 |
commit | 54b15dae509212f6661dc1f1bc4ca248cb487443 (patch) | |
tree | 85b1ceafd9a56da511513797bd263977f52b556c /src/test/scala/xyz/driver/pdsuidomain/formats/json/BridgeUploadQueueFormatSuite.scala | |
parent | 6d6e732368e97e319653f00e498189afceeb4671 (diff) | |
download | rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.tar.gz rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.tar.bz2 rest-query-54b15dae509212f6661dc1f1bc4ca248cb487443.zip |
PDSUI-2336 Deleted api classes of play format, userhistory and message services
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.scala | 32 |
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)) + } + +} |