FlexTradeUKLtd/jfixture

Problem with null values

Rutenioh opened this issue · 4 comments

Hello,

I need to create an object with a null value and I am having this error when I try to use the following statement:

fixture.customise().propertyOf(MyClass.class, "value", null);

The error is:
java.lang.NullPointerException
at com.flextrade.jfixture.customisation.OverridePropertyBuilder.create(OverridePropertyBuilder.java:44)
at com.flextrade.jfixture.builders.CompositeBuilder.create(CompositeBuilder.java:26)
at com.flextrade.jfixture.behaviours.autoproperty.AutoPropertyBuilder.create(AutoPropertyBuilder.java:22)
at com.flextrade.jfixture.behaviours.recursion.RecursionGuard.create(RecursionGuard.java:33)
at com.flextrade.jfixture.behaviours.noresolution.NoResolutionGuard.create(NoResolutionGuard.java:27)
at com.flextrade.jfixture.behaviours.specimentype.SpecimenTypeInjector.create(SpecimenTypeInjector.java:26)
at com.flextrade.jfixture.SpecimenBuilderContext.resolve(SpecimenBuilderContext.java:13)

Looks like the type condition is not prepared to check a null against a setter. Looks to be an easy localized fix. @richkeenan would you accept a PR?

I could merge a PR but I can't do releases as I've not worked for the parent company for many years (I don't have the keys). Tagging @philipwhiuk who'd be a better contact

Hi @philipwhiuk, do you know if this project is alive? It would be a great idea if the community can evolve the library.

Hi @TWiStErRob,
how would you fix it?
I want to learn