Skip to content

replace @MockBean and @SpyBean#2023

Merged
ryanjbaxter merged 4 commits into
spring-cloud:3.2.xfrom
wind57:replace_mock_and_spy_bean
Sep 27, 2025
Merged

replace @MockBean and @SpyBean#2023
ryanjbaxter merged 4 commits into
spring-cloud:3.2.xfrom
wind57:replace_mock_and_spy_bean

Conversation

@wind57

@wind57 wind57 commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: wind57 <eugen.rabii@gmail.com>
Signed-off-by: wind57 <eugen.rabii@gmail.com>
Signed-off-by: wind57 <eugen.rabii@gmail.com>
Signed-off-by: wind57 <eugen.rabii@gmail.com>
verify(propertySourceLocator, times(1)).locate(any());
}

@TestConfiguration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only place where a drop-in replacement for the deprecated annotation is not possible. It is rather interesting why.

@SpyBean creates a bean if such is not present already, while @MockitoSyBean expects one to be present already.

In this case, we don't have a bean of type Fabric8ConfigMapPropertySourceLocator, so we need to provide one. But its not visible, so we provide an extension of it

@wind57 wind57 marked this pull request as ready for review September 27, 2025 10:19
@wind57

wind57 commented Sep 27, 2025

Copy link
Copy Markdown
Contributor Author

@ryanjbaxter this one is ready also.

@ryanjbaxter ryanjbaxter added this to the 3.2.3 milestone Sep 27, 2025
@ryanjbaxter ryanjbaxter merged commit dde0a19 into spring-cloud:3.2.x Sep 27, 2025
17 checks passed
@github-project-automation github-project-automation Bot moved this to Done in 2024.0.3 Sep 27, 2025
@github-project-automation github-project-automation Bot moved this to Done in 2025.0.1 Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done
Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants