Fixture Monkey when instantiating a Java Record should use the canonical constructor instead of the first one that it finds.
public record Value(UUID value) {
public Value(String value) {
this(UUID.fromString(value));
}
}
On this scenario Fixture Monkey will try and use the String constructor so it will generate a random String that isn´t a valid UUID so an exception will be thrown. (Some Java Compiler options can change the constructor order also)
I can force this Record to be generated with an UUID but on a project with thousands of similar records with the same problem it becomes unmanageable.
So I think that by default for the records it should use the canonical constructor. That way the object will be always instantiated.
Describe the feature you request
Fixture Monkey when instantiating a Java Record should use the canonical constructor instead of the first one that it finds.
On this scenario Fixture Monkey will try and use the
String
constructor so it will generate a randomString
that isn´t a validUUID
so an exception will be thrown. (Some Java Compiler options can change the constructor order also) I can force thisRecord
to be generated with anUUID
but on a project with thousands of similar records with the same problem it becomes unmanageable. So I think that by default for the records it should use the canonical constructor. That way the object will be always instantiated.