Quantcast
Channel: Spring beans redefinition in unit test environment - Stack Overflow
Viewing all articles
Browse latest Browse all 14

Answer by Ev0oD for Spring beans redefinition in unit test environment

$
0
0

See this tutorial with @InjectedMock annotation

It saved me a lot of time. You just use

@MockSomeClass mockedSomeClass@InjectMockClassUsingSomeClass service@Beforepublic void setUp() {    MockitoAnnotations.initMocks(this);}

and all your problems are solved. Mockito will replace the spring dependency injection with a mock. I just used it myself and it works great.


Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>