How can you track down a unclosed static mock?
Suppose I have two classes, MyObject1
and MyObject2
, both of which use Mockito to declare a static mock MyStaticObject
. Suppose MyObject1
forgets to close MyStaticObject
causing MyObject2
test cases to fail with the following exception:
Mock Getter Method for Private Final Field With Mockito
I am pretty new to Mockito and Junit 5.
I am trying to mock out the Config class’s getNumber() method so that it returns -1.