Ultimately, (as is usually the case) the answer was somewhat simple. My mock methods had all been declared irrelevant by this change to Mockito:
anyString() no longer accepts nulls.
So a mock method like this:
when(mockClass.mockMethod(anyString())).thenReturn("All your base are belong to me")
Simply stopped returning anything.
https://github.com/mockito/mockito/issues/185
The workaround is either to use any() or a deliberate null.
when(mockClass.mockMethod(any())).thenReturn("All your base are belong to me")
when(mockClass.mockMethod(isNull())).thenReturn("All your base are belong to me")
I hope this helps someone avoid my mistakes. Happy coding.
No comments:
Post a Comment