diff options
author | Aleksandr <ognelisar@gmail.com> | 2017-10-20 14:56:06 +0700 |
---|---|---|
committer | Aleksandr <ognelisar@gmail.com> | 2017-10-20 14:56:06 +0700 |
commit | 0e0da76f6a8866a7c04d01a42d305aceb94c2e75 (patch) | |
tree | da1a3adc13dcb8c64891d5ef5361ce89a89d21ab /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala | |
parent | 997407855c2293264dd160e6841f342aeaccf02a (diff) | |
parent | 6d6e732368e97e319653f00e498189afceeb4671 (diff) | |
download | rest-query-0e0da76f6a8866a7c04d01a42d305aceb94c2e75.tar.gz rest-query-0e0da76f6a8866a7c04d01a42d305aceb94c2e75.tar.bz2 rest-query-0e0da76f6a8866a7c04d01a42d305aceb94c2e75.zip |
Merge branch 'master' into TRIAL-55
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala index 0ac2be5..2aaa251 100644 --- a/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala +++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala @@ -7,6 +7,7 @@ import xyz.driver.entities.common.FullName import xyz.driver.entities.patient.CancerType import xyz.driver.pdsuicommon.concurrent.BridgeUploadQueue import xyz.driver.pdsuicommon.domain.{LongId, StringId, TextJson, UuidId} +import xyz.driver.pdsuidomain.ListResponse import xyz.driver.pdsuidomain.entities._ import scala.util.Random @@ -85,10 +86,38 @@ object common { ) } + def nextBridgeUploadQueueItemListResponse(): ListResponse[BridgeUploadQueue.Item] = { + val xs: Seq[BridgeUploadQueue.Item] = Seq.fill(3)(nextBridgeUploadQueueItem()) + nextListResponse(xs) + } + def nextDocumentType(): DocumentType = generators.oneOf[DocumentType](DocumentType.All: _*) def nextProviderType(): ProviderType = generators.oneOf[ProviderType](ProviderType.All: _*) + def nextDocumentTypeListResponse(): ListResponse[DocumentType] = { + val xs: Seq[DocumentType] = Seq.fill(3)(nextDocumentType()) + nextListResponse(xs) + } + + def nextProviderTypeListResponse(): ListResponse[ProviderType] = { + val xs: Seq[ProviderType] = Seq.fill(3)(nextProviderType()) + nextListResponse(xs) + } + def nextTextJson[T](obj: T): TextJson[T] = TextJson(obj) + def nextListResponse[T](xs: Seq[T]): ListResponse[T] = { + val pageSize = generators.nextInt(xs.size, 1) + ListResponse( + items = xs, + meta = ListResponse.Meta( + itemsCount = xs.size, + pageNumber = generators.nextInt(xs.size / pageSize), + pageSize = pageSize, + lastUpdate = generators.nextOption(nextLocalDateTime) + ) + ) + } + } |