Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explicitly type implicit definitions (#881)
* Explicitly type implicit definitions * Prefer using JavaDuration to distinguish from Scala's Duration
- Loading branch information
Showing
11 changed files
with
105 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 31 additions & 22 deletions
53
testkit/src/main/scala/pureconfig/arbitrary/package.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
package pureconfig | ||
|
||
import java.io.File | ||
import java.math.BigInteger | ||
import java.nio.file.Path | ||
import java.time.{Duration => JavaDuration, _} | ||
import java.util.UUID | ||
|
||
import scala.concurrent.duration.{Duration, FiniteDuration} | ||
|
||
import org.scalacheck.{Arbitrary, Gen} | ||
import pureconfig.data.Percentage | ||
import pureconfig.gen._ | ||
|
||
package object arbitrary { | ||
|
||
implicit val arbDuration = Arbitrary(genDuration) | ||
implicit val arbJavaDuration = Arbitrary(genJavaDuration) | ||
implicit val arbFiniteDuration = Arbitrary(genFiniteDuration) | ||
implicit val arbInstant = Arbitrary(genInstant) | ||
implicit val arbPeriod = Arbitrary(genPeriod) | ||
implicit val arbYear = Arbitrary(genYear) | ||
implicit val arbUUID = Arbitrary(Gen.uuid) | ||
implicit val arbPath = Arbitrary(genPath) | ||
implicit val arbFile = Arbitrary(genFile) | ||
implicit val arbPercentage = Arbitrary(genPercentage) | ||
implicit val arbJavaBigDecimal = Arbitrary(genJavaBigDecimal) | ||
implicit val arbJavaBigInteger = Arbitrary(genBigInt) | ||
implicit val arbDuration: Arbitrary[Duration] = Arbitrary(genDuration) | ||
implicit val arbJavaDuration: Arbitrary[JavaDuration] = Arbitrary(genJavaDuration) | ||
implicit val arbFiniteDuration: Arbitrary[FiniteDuration] = Arbitrary(genFiniteDuration) | ||
implicit val arbInstant: Arbitrary[Instant] = Arbitrary(genInstant) | ||
implicit val arbPeriod: Arbitrary[Period] = Arbitrary(genPeriod) | ||
implicit val arbYear: Arbitrary[Year] = Arbitrary(genYear) | ||
implicit val arbUUID: Arbitrary[UUID] = Arbitrary(Gen.uuid) | ||
implicit val arbPath: Arbitrary[Path] = Arbitrary(genPath) | ||
implicit val arbFile: Arbitrary[File] = Arbitrary(genFile) | ||
implicit val arbPercentage: Arbitrary[Percentage] = Arbitrary(genPercentage) | ||
implicit val arbJavaBigDecimal: Arbitrary[java.math.BigDecimal] = Arbitrary(genJavaBigDecimal) | ||
implicit val arbJavaBigInteger: Arbitrary[BigInteger] = Arbitrary(genBigInt) | ||
|
||
implicit val arbLocalTime = Arbitrary(genLocalTime) | ||
implicit val arbLocalDate = Arbitrary(genLocalDate) | ||
implicit val arbLocalDateTime = Arbitrary(genLocalDateTime) | ||
implicit val arbMonthDay = Arbitrary(genMonthDay) | ||
implicit val arbZoneOffset = Arbitrary(genZoneOffset) | ||
implicit val arbOffsetDateTime = Arbitrary(genOffsetDateTime) | ||
implicit val arbOffsetTime = Arbitrary(genOffsetTime) | ||
implicit val arbYearMonth = Arbitrary(genYearMonth) | ||
implicit val arbZoneId = Arbitrary(genZoneId) | ||
implicit val arbZonedDateTime = Arbitrary(genZonedDateTime) | ||
implicit val arbLocalTime: Arbitrary[LocalTime] = Arbitrary(genLocalTime) | ||
implicit val arbLocalDate: Arbitrary[LocalDate] = Arbitrary(genLocalDate) | ||
implicit val arbLocalDateTime: Arbitrary[LocalDateTime] = Arbitrary(genLocalDateTime) | ||
implicit val arbMonthDay: Arbitrary[MonthDay] = Arbitrary(genMonthDay) | ||
implicit val arbZoneOffset: Arbitrary[ZoneOffset] = Arbitrary(genZoneOffset) | ||
implicit val arbOffsetDateTime: Arbitrary[OffsetDateTime] = Arbitrary(genOffsetDateTime) | ||
implicit val arbOffsetTime: Arbitrary[OffsetTime] = Arbitrary(genOffsetTime) | ||
implicit val arbYearMonth: Arbitrary[YearMonth] = Arbitrary(genYearMonth) | ||
implicit val arbZoneId: Arbitrary[ZoneId] = Arbitrary(genZoneId) | ||
implicit val arbZonedDateTime: Arbitrary[ZonedDateTime] = Arbitrary(genZonedDateTime) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.