[pull] master from j-easy:master#47
Open
pull[bot] wants to merge 41 commits into
Open
Conversation
Resolves #476
This will notably remove download progress in logs
That way, extending BeanValidationRandomizerRegistry and appending to annotationHandlers is possible.
Ensures `EnumRandomizer` can be used deterministically even when excluding values by specifying a seed to be overwritten.
Resolves #499
Resolves #458
Prior to this commit, getDeclaredFields accepted an object and called type.getClass().getDeclaredFields(). Passing Street.class therefore introspected java.lang.Class instead of Street, which made the test depend on JDK-internal Class fields that vary across vendors and versions. This commit changes getDeclaredFields to accept Class<?> directly, updates production code to pass result.getClass(), and simplifies the regression test to assert the real declared field count of Street. Resolves #522
Prior to this commit, generic type resolution only looked at a single parameterized superclass when resolving a field type. That breaks inheritance chains where type variables are remapped through an intermediate generic type, which caused randomization to miss the concrete type for fields declared higher in the hierarchy. This commit updates field type resolution to walk the superclass chain while carrying type variable mappings forward until the declaring class is reached. It also keeps the regression coverage in EasyRandomTest for the Base<T, S> -> Intermediate<S> -> Concrete case so the intermediate remapping path stays exercised. Resolves #443
Prior to this commit, inherited generic fields were resolved against the root type of the randomization request instead of the class that actually owned the field being populated. In nested object graphs, this caused Easy Random to walk the wrong type hierarchy and fall back to erased bounds. For a type like LongResource extends IdResource<Long, LongResource>, the inherited id field could therefore be treated as Serializable rather than Long. This commit changes field population to resolve generic type variables against the current owning object type instead of the root context type. It also keeps type-variable resolution ahead of the abstract/interface scan path so resolved concrete types are used before falling back to erased field types. The regression coverage now lives in EasyRandomTest and exercises the nested inherited generic case to ensure the id field of LongResource is populated as a Long. Resolves #441
Prior to this commit, EnumSetRandomizer could be constructed with zero requested elements. In that case it built an empty list and passed it to EnumSet.copyOf, which throws an IllegalArgumentException with the message 'Collection is empty'. This made the randomizer fail for a valid internal state inherited from the shared collection randomizer behavior. This commit changes EnumSetRandomizer to guarantee at least one generated enum constant before creating the EnumSet. The fix is intentionally local to EnumSetRandomizer, since EnumSet.copyOf cannot accept an empty collection even though other collection randomizers may legitimately generate zero elements. A regression test was added to cover the zero-elements case directly and verify that a non-empty EnumSet is returned instead of throwing. Resolves #489
Prior to this commit, several time-related randomizers could never generate their documented upper bound values. The issue came from using an exclusive double-based helper for values that are ultimately interpreted as discrete time components such as hours, minutes, seconds, and nanoseconds. As a result, values like hour 23 or minute 59 were practically unreachable, and range-based time randomizers inherited the same off-by-one behavior. This commit fixes the problem in the time randomizer path by making time component generation inclusive on the upper bound where those values represent valid discrete endpoints. HourRandomizer, MinuteRandomizer, and NanoSecondRandomizer now delegate to inclusive ranges, and the LocalTime, LocalDateTime, OffsetTime, OffsetDateTime, and ZonedDateTime range randomizers now use dedicated inclusive integer/long generation instead of truncating exclusive double ranges. Resolves #507
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )