Skip to content
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

LocalDateTimeRangeRandomizer Min-Max Exception due time of day #361

Closed
morvader opened this issue Jun 7, 2019 · 1 comment
Closed

LocalDateTimeRangeRandomizer Min-Max Exception due time of day #361

morvader opened this issue Jun 7, 2019 · 1 comment
Labels
Milestone

Comments

@morvader
Copy link

morvader commented Jun 7, 2019

Hi,

I have this data generator:

EasyRandomParameters parameters = new EasyRandomParameters()
                .collectionSizeRange(nDatos, nDatos)
                .randomize(FieldPredicates.ofType(double.class),
                        new DoubleRangeRandomizer(0d, 9999d))
                .randomize(FieldPredicates.ofType(float.class),
                        new FloatRangeRandomizer(0f, 9999f))
                .randomize(FieldPredicates.ofType(int.class),
                        new IntegerRangeRandomizer(0, 9999))
                .randomize(FieldPredicates.named("endDate"), () -> LocalDateTime.now())
                .randomize(FieldPredicates.named("initDate"),
                        new LocalDateTimeRangeRandomizer(LocalDateTime.now().minusSeconds(rangoIntervalo.getSeconds())
                                , LocalDateTime.now()));

The issue is related to LocalDateTimeRangeRandomizer, some time the range gets yesterday, so the time of the day could be greater than now. As show is this example:

imagen

That second comparator is whats is causing the exception. First LocalDateDate is actually before the second, but not the dateTimes.

It would be ok to remove the LocalTime check?

johkin added a commit to johkin/easy-random that referenced this issue Oct 21, 2019
The randomizer could not generate datetime if the range span midnight, since the min/max-check failed for the LocalTimeRangeRandomizer.
The new implementation breaks the current seed-based generation.

j-easy#361
johkin added a commit to johkin/easy-random that referenced this issue Oct 22, 2019
@fmbenhassine fmbenhassine added this to the 4.1.0 milestone Oct 25, 2019
@fmbenhassine
Copy link
Member

Thanks for reporting this issue! I believe it should be resolved with #373 .

You can already give it a try with 4.1.0-SNAPSHOT. If you still have the problem, please re-open this issue.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants