Reputation: 496
I am writing a new SpringBoot unit test which requires injecting a @MockBean which I added and is working as expected. But unfortunately, the mockbean is messing up with some of the existing tests causing them to fail. Is there any way I can inject @MockBean to the particular test alone so that the other tests are unaffected? Thanks
Upvotes: 0
Views: 1713
Reputation: 265291
One option is to create a second test class which only contains a single test. The MockBean will then not affect the existing tests.
Upvotes: 1