I want to test a class where I want to mock one of its method calls, getMessage(). This is a protected method in its parent abstract class. The problem I am facing is that on the line I declare the mock (Mokito.when()), it actually goes ahead and calls the real method.
ClassUnderTest partialMockClassUnderTest = Mockito
.spy(new ClassUnderTest());
Mockito.when(
partialMockClassUnderTest
.getMessage())
.thenReturn("Mock Message");
Aucun commentaire:
Enregistrer un commentaire