-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Granularity #7
Granularity #7
Conversation
Current coverage is 100% (diff: 100%)@@ master #7 diff @@
===================================
Files 5 8 +3
Lines 35 76 +41
Methods 35 76 +41
Messages 0 0
Branches 0 0
===================================
+ Hits 35 76 +41
Misses 0 0
Partials 0 0
|
|
||
val granularitiesAndPredicatesWithDefault: List[(Granularity[ZonedDateTime], ZonedDateTime => Boolean)] = (Granularity.identity[ZonedDateTime], (_: ZonedDateTime) => true) :: granularitiesAndPredicates | ||
|
||
property("genZonedDateTime with a granularity generated appropriate ZonedDateTimes") = forAll(Gen.oneOf(granularitiesAndPredicates)) { case (granularity, predicate) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a typo? generated
-> generates
Minor comment. LGTM Great job @noelmarkham! |
} | ||
} | ||
|
||
property("genDateTimeWithinRange for Java 8 should generate ZonedDateTimes between the given date and the end of the specified Duration") = forAll(genZonedDateTime, genDuration, Gen.oneOf(granularitiesAndPredicatesWithDefault)) { case (now, d, (granularity, predicate)) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a picky comment, could we split these long lines into shorter ones?
Just a couple of minor comments about long lines :) Code looks great! Thanks @noelmarkham!! |
Addressed changes, thanks |
This PR allows importing of a
Granularity
type to restrict the precision of a generated date.The import takes the form:
For instance:
These imports are optional, not including it gives maximum precision.
This works both for the
genDateTime
(Joda) andgenZonedDateTime
(Jdk8) generators, but also on thegenDateTimeWithinRange
method - allowing both generation with a specific range of time, to a certain precision, for both Joda and Jdk8 setups.Resolves #3