Wednesday, July 17, 2019

NullPointerExceptions from PowerMock can indicate a non-mocked static class

Today I was writing some PowerMock-based test code and encountered a NullPointerException in the middle of normal-looking and previously-working mock configuration for a static method. Another test in the same test suite was failing with an UnfinishedStubbingException in something that also looked reasonable. It turned out that I had forgotten to PowerMockito.mockStatic the class in that test.

No comments:

Post a Comment