2021年2月2日星期二

NPE for only one bean when using @Mock

I am trying to figure out why is my test producing NPE for this one particular mock, other mocks are working fine when I checked in debug mode.

This is my test base class:

public class BaseTestCase {      public PodamFactory podamFactory = new PodamFactoryImpl();        @BeforeEach      void initMocks() {          MockitoAnnotations.initMocks(this);      }        @BeforeEach      void beforeEachSeparator() {          System.out.println("**--- Executed before each test method in this class ---**");      }  }  

And my test class extends this base test. This is my debug result. Debug result

https://stackoverflow.com/questions/66020600/npe-for-only-one-bean-when-using-mock February 03, 2021 at 10:57AM

没有评论:

发表评论