aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-08-28 15:27:40 +0700
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-08-29 13:11:39 +0700
commit7bf2da3afbde1b4cec0d68cb4899e51a63e8a9b1 (patch)
treec31407bbe1a09918fc73b64484466f8b38244176 /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
parent116c78627fd22c4a6b70d5343d6e89fa9ab9e7ad (diff)
downloadrest-query-7bf2da3afbde1b4cec0d68cb4899e51a63e8a9b1.tar.gz
rest-query-7bf2da3afbde1b4cec0d68cb4899e51a63e8a9b1.tar.bz2
rest-query-7bf2da3afbde1b4cec0d68cb4899e51a63e8a9b1.zip
Created custom formats of TriC for swagger
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.scala34
1 files changed, 34 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
new file mode 100644
index 0000000..fbab2ce
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala
@@ -0,0 +1,34 @@
+package xyz.driver.pdsuidomain.fakes.entities
+
+import java.time.{LocalDate, LocalDateTime, LocalTime}
+
+import xyz.driver.pdsuicommon.domain.{LongId, StringId, UuidId}
+import xyz.driver.pdsuidomain.entities.{Trial, TrialHistory}
+
+object common {
+ import xyz.driver.core.generators
+
+ def nextUuidId[T] = UuidId[T](generators.nextUuid())
+
+ def nextLongId[T] = LongId[T](generators.nextInt(Int.MaxValue).toLong)
+
+ def nextStringId[T] = StringId[T](generators.nextString(maxLength = 20))
+
+ def nextTrialStatus = generators.oneOf[Trial.Status](Trial.Status.All)
+
+ def nextPreviousTrialStatus = generators.oneOf[Trial.Status](Trial.Status.AllPrevious)
+
+ def nextLocalDateTime = LocalDateTime.of(nextLocalDate, LocalTime.MIDNIGHT)
+
+ def nextLocalDate = {
+ val date = generators.nextDate()
+ LocalDate.of(date.year, date.month, date.day)
+ }
+
+ def nextCondition = generators.oneOf[Trial.Condition](Trial.Condition.All)
+
+ def nextTrialAction = generators.oneOf[TrialHistory.Action](TrialHistory.Action.All)
+
+ def nextTrialState = generators.oneOf[TrialHistory.State](TrialHistory.State.All)
+
+}