You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running the above testRecursionContainer test runs fine on all versions, but as you can see the expectation has changed in testRecursionList and it behaves differently on different versions: in 2.7.0 the recursive structure ended up being an empty list, but after 4306daa this became a null list. This wouldn't be a problem, but as you can see the commented (this.refs = Collections.unmodifiableList(refs);) line in the model, passing in a null will crash unmodifiableList and that will in turn cause this exception (only on 2.7.1 and 2.7.2):
java.lang.UnsupportedOperationException: JFixturewasunabletocreateaninstanceofcom.example.ItemMostlikelybecauseithasnopublicconstructor,isanabstractornon-publictypeorhasnostaticfactorymethods.Ifthisisn't the case it'slikelythatallconstructorsandfactorymethodsonthetypehavethrownanexception.ToviewanythrownexceptionsjustaddtheTracingCustomisationtotheJFixtureinstance,e.g.fixture.customise(newTracingCustomisation(System.out));java.util.List<com.example.Ref> -->com.example.Ref -->publiccom.example.Ref(com.example.Container) -->com.example.Container -->publiccom.example.Container(java.util.List) -->java.util.List<com.example.Item> -->com.example.Item -->publiccom.example.Item(java.util.List) -->com.example.Itematcom.flextrade.jfixture.behaviours.noresolution.ThrowingNoResolutionHandler.handleNoResolution(ThrowingNoResolutionHandler.java:9)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.handleNoResolutionForRequest(NoResolutionGuard.java:52)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:29)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.builders.MultipleSpecimenRelay.buildArrayList(MultipleSpecimenRelay.java:33)atcom.flextrade.jfixture.builders.MultipleSpecimenRelay.create(MultipleSpecimenRelay.java:26)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.builders.IterableRelay.create(IterableRelay.java:34)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.utility.ParameterUtils.convertTypesToInstances(ParameterUtils.java:28)atcom.flextrade.jfixture.utility.ParameterUtils.getConstructorArguments(ParameterUtils.java:16)atcom.flextrade.jfixture.builders.GenericConstructorRelay.create(GenericConstructorRelay.java:27)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.builders.ClassToConstructorRelay.create(ClassToConstructorRelay.java:51)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.utility.ParameterUtils.convertTypesToInstances(ParameterUtils.java:28)atcom.flextrade.jfixture.utility.ParameterUtils.getConstructorArguments(ParameterUtils.java:16)atcom.flextrade.jfixture.builders.GenericConstructorRelay.create(GenericConstructorRelay.java:27)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.builders.ClassToConstructorRelay.create(ClassToConstructorRelay.java:51)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.builders.MultipleSpecimenRelay.buildArrayList(MultipleSpecimenRelay.java:33)atcom.flextrade.jfixture.builders.MultipleSpecimenRelay.create(MultipleSpecimenRelay.java:26)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)atcom.flextrade.jfixture.builders.IterableRelay.create(IterableRelay.java:34)atcom.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)atcom.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)atcom.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)atcom.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)atcom.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)atcom.flextrade.jfixture.JFixture.create(JFixture.java:82)atcom.flextrade.jfixture.JFixture.create(JFixture.java:73)atcom.example.OmitSpecimentTest.testRecursionList(OmitSpecimentTest.java:28)
So it looks like the fix of #33 introduced a behavior change that may have not been intended. Although it looks logical as the recursion now actually matches the original type (see List<Ref> recurses instead of Ref recurses in comment in the test).
The text was updated successfully, but these errors were encountered:
TWiStErRob
changed the title
Potentially unintended behavior change
Potentially unintended behavior change of circularDependencyBehaviour().omitSpecimen()
Nov 12, 2020
When upgrading from 2.7.0 to 2.7.2 I got some weird failures.
I narrowed it down to V2.7.0...V2.7.1 range and specifically this commit: 4306daa
Consider the following data structure:
and a test:
Running the above
testRecursionContainer
test runs fine on all versions, but as you can see the expectation has changed intestRecursionList
and it behaves differently on different versions: in 2.7.0 the recursive structure ended up being an empty list, but after 4306daa this became a null list. This wouldn't be a problem, but as you can see the commented (this.refs = Collections.unmodifiableList(refs);
) line in the model, passing in a null will crashunmodifiableList
and that will in turn cause this exception (only on 2.7.1 and 2.7.2):So it looks like the fix of #33 introduced a behavior change that may have not been intended. Although it looks logical as the recursion now actually matches the original type (see
List<Ref> recurses
instead ofRef recurses
in comment in the test).The text was updated successfully, but these errors were encountered: