Skip to content
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

Improved error message on double registration #98

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

staale
Copy link
Contributor

@staale staale commented Jan 9, 2025

As requested, an example using Mockito.

I added some more tests, and it occurred to me that we might want to have a nice error message on duplicate registrations, in case you register both in a top class and a nested class. This would have failed in any case (and does not make sense imho.). The entire test suite uses 1 MatsFactory, so it is global for all tests.

We know track when we register a mats annotated bean, and detect double
registration of the same class (but not the same endpoint, that is
covered by Mats). This should only occur if you register the same class
on the declaration level and in the method, or in the parent and nested
tests.

Also added test example of Mockito

Added some extra life cycle tests for the Extension_MatsAnnotatedClass,
the same criterias should hold true for jUnit, but it is a bit easier to
test in Jupiter with nested classes. It mainly tests the Abstract class.
@stolsvik stolsvik merged commit d358762 into centiservice:main Jan 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants