naver / naver/fixture-monkey

Priority and Name-based Operations Not Applied Due to Type Mismatch Issue in `set()`

Open
#1,206 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
699
Forks
124
Avg merge
24m
Merged PRs (30d)
7

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).

References

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the registerByName, selectName, and set operations in the Fixture Monkey codebase, using the reproduction in the issue as the behavioral guide. Review the referenced pull requests and issue comment for context on manipulator priority and type matching. Done means the shown property test selects the set value for str despite the String builder, while name-based operations remain correctly prioritized.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.