Skip to content

When using @MockitoBean and @MockitoSpyBean make it easier to inject any underlying proxy target as well as the mock or spy #33743

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

Open
wilkinsona opened this issue Aug 5, 2020 · 5 comments
Labels
in: test Issues in the test module status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement

Comments

@wilkinsona
Copy link
Member

wilkinsona commented Aug 5, 2020

We'd like to support something like this:

@MockitoSpyBean
ProxiedBean<Service> service;

ProxiedBean would then provide accessors for the bean both with and without all of its Spring proxies. This should make it easier to bypass any caching or advice when, for example, setting expectations, while having them in place when exercising the service.

Hopefully this will address spring-projects/spring-boot#22281 by providing a nicer API that can be used in place of AopTestUtils.getTargetObject(service).

@wilkinsona wilkinsona added the type: enhancement A general enhancement label Aug 5, 2020
@wilkinsona wilkinsona changed the title When using @MockBean and @SpyBean make it easy to inject any underlying proxy target as well as the mock or spy When using @MockBean and @SpyBean make it easier to inject any underlying proxy target as well as the mock or spy Aug 5, 2020
@philwebb philwebb added the status: pending-design-work Needs design work before any code can be developed label Oct 19, 2020
@kriegaex

This comment has been minimized.

@wilkinsona

This comment has been minimized.

@kriegaex

This comment has been minimized.

@wilkinsona

This comment has been minimized.

@philwebb philwebb added this to the General Backlog milestone Aug 19, 2022
@wilkinsona

This comment was marked as outdated.

@bclozel bclozel transferred this issue from spring-projects/spring-boot Oct 18, 2024
@sbrannen sbrannen changed the title When using @MockBean and @SpyBean make it easier to inject any underlying proxy target as well as the mock or spy When using @MockitoBean and @MockitoSpyBean make it easier to inject any underlying proxy target as well as the mock or spy Oct 18, 2024
@sbrannen sbrannen added the in: test Issues in the test module label Oct 18, 2024
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 status: pending-design-work Needs design work before any code can be developed type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants