-
Notifications
You must be signed in to change notification settings - Fork 116
Description
Describe the bug
When an ArbitraryBuilder is registered using registerByName and configured with .set() to modify a specific field, the .set() operation is ignored if another, more specific manipulator exists for the field's type.
For example, even if a builder for SimpleObject is registered under the name "simpleObject" with a .set("str", ...) call, the str field will be manipulated by another builder registered for the String type under the name "string". This makes it appear as though the priority for selectName is not functioning correctly (also name-based operations).
@Property
void registerNestedSelectFormer() {
// given
String expected = "simpleObject";
FixtureMonkey sut = FixtureMonkey.builder()
.registeredName(
"simpleObject",
SimpleObject.class,
monkey -> monkey.giveMeBuilder(SimpleObject.class)
.set("str", expected)
)
.registeredName(
"string",
String.class,
monkey -> monkey.giveMeBuilder("string")
)
.build();
// when
String actual = sut.giveMeBuilder(SimpleObject.class)
.selectName("string", "simpleObject")
.sample()
.getStr();
then(actual).isEqualTo(expected);
}Your environment
- version of Fixture Monkey 1.1.15 (However, it is currently unavailable for use.)
Expected behaviour
When registerByName and .set() are used together, the manipulator selection process must correctly prioritize operations by considering the type of the nested field targeted by the .set() expression (also name-based operations).