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
java.lang.UnsupportedOperationException: Unable to handle MyClass
Unable to resolve class MyClass
Unable to populate class MyClass
Unable to instantiate class MyClass using factory methods
at com.appmattus.kotlinfixture.Fixture.create(KotlinFixture.kt:85)
because the proeprty name doesn't provide public setter.
How do I customize that field?
The text was updated successfully, but these errors were encountered:
Firstly, there's some validation that occurs that won't let you define that property override. It does this because MyClass::name is not a mutable property and so it checks to see if it appears in the constructor, as that would then be the only way for that override to work. Of course the property doesn't exist in the constructor so it fails because of the validation exception.
Secondly, if I remove the validation, the object will be created but the value will not be overridden as currently the overrides only work on public setters or constructor parameters.
Thinking about the other open issue (#90) which relates to latent vars I realised that there's no way to easily ignore property setting; and likewise customise properties that would otherwise not be set which is what you want here. This is something I'm currently looking at.
Consider we have a class to create a fixture like this:
when we do:
will throw an exception like this:
because the proeprty
name
doesn't provide public setter.How do I customize that field?
The text was updated successfully, but these errors were encountered: