You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This is a none Spring Boot project.
I try to use
mockk()
to mock a bean in the controller tests, but failed.The
PostController
depends on beanPostRepository
, here try to use amockk()
bean to mock thePostRepository
in our test config.The example project used the latest Spring 6.1.x WebFlux, Kotlin(1.9.22)/Kotlin Coroutines(1.7.3), and Java 21.
Check source codes here, https://github.com/hantsy/spring-reactive-sample/tree/master/kotlin-co
In before experience, I applied same mode which used Mockito to mock beans in Java codes, it worked.
Beta Was this translation helpful? Give feedback.
All reactions