Replace @MockBean and @SpyBean

MSAL

Replaces @MockBean and @SpyBean annotations with @MockitoBean and @MockitoSpyBean.

org.openrewrite.java.spring.boot4.ReplaceMockBeanAndSpyBean
mod run . --recipe=org.openrewrite.java.spring.boot4.ReplaceMockBeanAndSpyBean

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Unwrap @MockBeans and @SpyBeans container annotations
  2. Change annotation attribute name @MockBean(answer) to @MockBean(answers)
  3. Remove annotation attribute @MockBean(classes)
  4. Remove annotation attribute @MockBean(value)
  5. Change type MockBean to MockitoBean
  6. Remove annotation attribute @SpyBean(classes)
  7. Remove annotation attribute @SpyBean(value)
  8. Remove annotation attribute @SpyBean(proxyTargetAware)
  9. Change type SpyBean to MockitoSpyBean
  10. Change type org.springframework.boot.test.mock.mockito.MockReset to org.springframework.test.context.bean.override.mockito.MockReset