Skip to content

Rename OverrideMetadata for Bean Overrides #33702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sbrannen opened this issue Oct 14, 2024 · 1 comment
Closed

Rename OverrideMetadata for Bean Overrides #33702

sbrannen opened this issue Oct 14, 2024 · 1 comment
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@sbrannen
Copy link
Member

Within the org.springframework.test.context.bean.override package, OverrideMetadata sticks out like a sore thumb: it's the only public type whose name does not start with BeanOverride. Considering that alone, I'd suggest we rename it to BeanOverrideMetadata.

However, an OverrideMetadata component plays two roles: a factory for a bean override instance and a holder for metadata, and I would argue that "creation of the bean override instance" is the primary role of such a component. In addition, I find it a bit unusual that a "metadata" component "creates" something. Rather, it's usually the other way around: a component typically creates something from metadata. Along those lines, I consider an OverrideMetadata component more like a factory which creates a bean override instance based on metadata that is has been supplied.

In light of the above, I suggest that we rename OverrideMetadata to BeanOverrideFactory.

@sbrannen sbrannen added in: test Issues in the test module type: enhancement A general enhancement labels Oct 14, 2024
@sbrannen sbrannen added this to the 6.2.0-RC2 milestone Oct 14, 2024
@sbrannen sbrannen self-assigned this Oct 14, 2024
@simonbasle
Copy link
Contributor

After discussing this within the team, we aligned on BeanOverrideHandler. We also decided to rework the naming in the API a little bit where createOverride and track would be renamed to createOverrideInstance and trackOverrideInstance.

sbrannen added a commit that referenced this issue Nov 1, 2024
The extra "Bean" was accidentally added in commit ebdf6dc2fc.

See gh-33702
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants