Reputation: 3
I want to run a method even though in @Before I set
doReturn(mockResult).when(spyObject).getResult();
It makes sense to do that for all of my other test methods, but I want to test the getter and setter for result now. Is there a way to override the doReturn and force it to actually run the method, or should I just move the doReturn statement to the beginning of every test method?
Upvotes: 0
Views: 925
Reputation: 385
you can try using callRealMethod
when(mock.someMethod()).thenCallRealMethod();
Upvotes: 1