kotlinfixture
kotlinfixture copied to clipboard
Customizing property with private/protected setter
Consider we have a class to create a fixture like this:
class MyClass {
var name: String = "initial value"
protected set
}
when we do:
kotlinFixture {
property(MyClass::name) { "test" }
}
will throw an exception like this:
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?