Repository navigation
⚠️ Breaking Changes
Using fixture-monkey-jakarta-validation without fixture-monkey-starter?
Hibernate Validator is no longer included, so add a Bean Validation provider to your test dependencies:
testImplementation("org.hibernate.validator:hibernate-validator:7.0.5.Final")
testImplementation("org.glassfish:jakarta.el:4.0.2")Without a provider, generated values still respect the constraint annotations, but the generated object is no longer validated. If you use fixture-monkey-starter, nothing changes. (#1351) @onacit
register with a custom matcher or registerExactType now applies to nested properties too.
FixtureMonkey.builder()
.register(new MatcherOperator<>(
property -> property.getJvmType().getRawType() == Child.class,
fm -> fm.giveMeBuilder(Child.class).set("name", "custom")
))
.build();Before, name was "custom" only for giveMeOne(Child.class). Now giveMeOne(Parent.class).getChild() gets "custom" too. The same goes for an interface registered with registerExactType, such as List, Set or Map, when it appears as a field or element. (#1343)
Writing your own plugin or calling internal classes?
object-farm-api is now 0.1.6, and some internal and experimental APIs changed. See the release notes for the full list.
🐛 Bug Fixes
- An object you pass to
set(...)orregister(...)is no longer shared between samples. Changing one sampled object no longer changes the others, and a list you pass asArrays.asList(...)orList.of(...)comes back as a regular, modifiable list. UseValues.just(...)if you need the exact same instance. (#1356) - Customizations that were ignored since 1.2.0 work again (#1343, #1354, #1355):
customizeandpostConditionon a wildcard path such asvalues[*]set("list[0,1]", ...)customizeandpostConditionon a field of an object set as a whole withset("$", ...)in a registered builder- a
Values.just(...)value combined withsize(...)orset(...)
- You can set a list that mixes subtypes, such as a
List<Animal>holding aDogand aCat. (#1353) @poketopa - A builder registered with
register(Item.class, ...)now also applies to the elements of anItem[]array. (#1367) @YongGoose @DecimalMin("10.5")or@DecimalMaxwith a fractional value on anintorlongfield no longer fails. (#1335) @been1118- You can set a nested collection (a list of lists, a map of maps, including ones made with
List.oforMap.of) and then change an element inside it. (#1337) - A non-null Kotlin property of a sealed class or sealed interface type is no longer generated as
null. (#1338)
⚡ Improvements
- Object generation is about 43% faster. The same seed still produces the same values. (#1339)
- The rule for which customization wins on the same property is now consistent (#1343, #1346, #1354, #1355):
- what you declare on the builder you sample always wins over
register(...), - between registered builders, the one with the higher priority (lower number) wins,
- otherwise, the later declaration wins.
- what you declare on the builder you sample always wins over
🙌 Contributors
Thanks to @onacit, @poketopa, @YongGoose and @been1118 for their contributions in this release.
Full Changelog: 1.2.3...1.2.4