diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-09-05 07:56:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-05 07:56:19 -0700 |
commit | fe5baf300f31ea967b160380994e2e4ec34488f4 (patch) | |
tree | c31407bbe1a09918fc73b64484466f8b38244176 /src/main/scala/xyz/driver/pdsuidomain/fakes/entities/common.scala | |
parent | 116c78627fd22c4a6b70d5343d6e89fa9ab9e7ad (diff) | |
parent | 7bf2da3afbde1b4cec0d68cb4899e51a63e8a9b1 (diff) | |
download | rest-query-fe5baf300f31ea967b160380994e2e4ec34488f4.tar.gz rest-query-fe5baf300f31ea967b160380994e2e4ec34488f4.tar.bz2 rest-query-fe5baf300f31ea967b160380994e2e4ec34488f4.zip |
Merge pull request #22 from drivergroup/swagger
Custom formats 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.scala | 34 |
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) + +} |