v1.2.x
v1.2.1
Features
- object-farm-api (
0.1.3→0.1.4): addInlinedValueResolverand aFieldExtractor#reflection(InlinedValueResolver)overload, so a JVM language plugin can rebuild value types the language inlines into their owner's field.
Improvements
JvmTypeSystem(EXPERIMENTAL) now takes the individual parts a plugin contributes —nodePromoters(...),leafTypeResolvers(...),candidateGeneratorWrapper(...),inlinedValueResolver(...)— in place ofassemblyPlanner(AssemblyPlanner), andFixtureMonkeyBuilderbuilds the singleAssemblyPlannerfrom them once every plugin has been applied. As a result, registering severalJvmTypeSystemPlugins now combines what each one contributes instead of the last plugin replacing the earlier registrations.
Bug Fixes
- Fix
IllegalArgumentExceptionwhen an object with a Kotlinvalue classproperty is passed whole toset(...). The same applies to any type the language inlines into its owner's field, includingkotlin.time.DurationandUInt, and it also covers properties renamed by aPropertyNameResolver(e.g. Jackson's@JsonProperty).
v1.2.0
The legacy object tree engine (the default since 0.4.0) has been removed, and the adapter engine introduced as experimental in 1.1.17 is now the only and default object generation engine — wired automatically by FixtureMonkeyBuilder.
Everyday APIs (ArbitraryBuilder, giveMe*, set/size/thenApply) are unchanged. Extension points that plugged into the old engine internals have been removed — see Breaking Changes. Authors of custom Property / PropertyGenerator / ArbitraryIntrospector implementations should review this release carefully.
Features
- Add a new extension SPI for JVM languages —
JvmTypeSystemPlugin/JvmTypeSystem/LeafTypeRegistry— allowing a plugin to install a customAssemblyPlannerviaFixtureMonkeyBuilder.plugin(...). - Add
FixtureMonkeyBuilder#tracer(AssemblyTracer)to attach a resolution tracer directly for debugging value generation. - Add
TypeReference#getJvmType()andArbitraryGeneratorContext#getResolvedJvmType(). - Add
Types#normalizeRawType(...), aTypes#toJvmType(...)overload, andTypes#toAnnotatedType(JvmType)utilities.
Improvements
@Seednow takes precedence overFixtureMonkeyBuilder#seed(long), and the seed is scoped and released per test — even when the test or another extension throws. Previously the global seed could leak across tests or be overwritten by a builder's defaultSystem.nanoTime()seed.- Container sizes are now reproducible across reruns with the same seed: container-size randomness is tracked by a dedicated counter, decoupled from value generation so cache hit/miss patterns no longer perturb sizes.
- Object generation now preserves declaration/iteration order (
LinkedHashMapinstead ofHashMap), fixing cases where Kotlin aliased constructor parameters received values on the wrong parameter. Note: for a fixed seed, the generated random stream may differ from 1.1.x as a result. FixtureMonkeyOptionsBuilder#defaultNullInjectGeneratorOperator(...)now composes successive operators instead of overwriting the previous one..size()wildcard-vs-exact-path precedence is now resolved at build time, so a higher-priority wildcard size correctly applies at a shadowed exact path.
Bug Fixes
- Prevent
IllegalArgumentExceptionfrom injectingnullinto primitive-typed slots. - Prevent
NullPointerExceptionwhen apostCondition/filter predicate is registered at a path that would otherwise receive an injectednull. - Prevent
StackOverflowErroron self-referential interface properties resolved through the anonymous-interface proxy. - Fix recursive/self-referential container types (e.g. a type containing
List<Self>) producing unbuildable children. - Recognize custom container types such as Kotlin
Pair/Triplecorrectly. - Fix per-type introspector chains (e.g.
PriorityConstructorArbitraryIntrospector) using the wrongPropertyGeneratorfor nested types.
Deprecations
- Deprecate
ArbitraryGeneratorContext#getResolvedType()and#getResolvedAnnotatedType()— use#getResolvedJvmType(). - Deprecate
PropertyUtils#toProperty(AnnotatedType)— use the newtoProperty(JvmType)overload.
Breaking Changes
Propertyinterface:getType()is removed (usegetJvmType()),getAnnotatedType()is removed, andgetValue(Object)is removed (value extraction is no longer part of thePropertycontract). Built-in implementations (FieldProperty,ConstructorProperty,RootProperty,MapEntryElementProperty, etc.) have new constructor signatures accordingly.ArbitraryGeneratorContext#getResolvedType()now returnsClass<?>instead ofjava.lang.reflect.Type.ContainerPropertyGenerator.DEFAULT_ELEMENT_RAW_TYPEis removed — useDEFAULT_ELEMENT_JVM_TYPE.- Remove the legacy generation engine: the
c.n.f.tree.*package,c.n.f.expression.*(ArbitraryExpression,MonkeyExpression,MonkeyExpressionFactory), and the manipulator family (NodeManipulator,ArbitraryManipulator,ContainerInfoManipulator, …) together with theNodeResolverSPI.AssemblyPlanneris now used automatically. - Remove the experimental adapter-bridge SPI added in 1.1.17:
NodeTreeAdapter,DefaultNodeTreeAdapter,JavaNodeTreeAdapterPlugin, and Kotlin'sKotlinNodeTreeAdapterPlugin— replaced by the automaticAssemblyPlanner+JvmTypeSystemPlugin. - Remove
FixtureMonkeyOptionsBuilder#nodeTreeAdapter(...)/#adapterTracer(...)and the correspondingFixtureMonkeyOptionsgetters. UseFixtureMonkeyBuilder#tracer(AssemblyTracer)instead. - object-farm-api (
0.1.2→0.1.3): remove theJavaTypeclass (useReflectiveJvmType) and the deprecatedJvmType#getAnnotatedType().