Getting an UnfinishedStubbingException with void method

11 views
Skip to first unread message

Rodrigo

unread,
Dec 17, 2020, 1:59:28 PM12/17/20
to mockito
Hi all

I'm using Mockito and I'm getting an UnfinishedStubbingException when I try to run my Junit test but I did not discover the reason why yet... Do you guys know what can be the reason of this exception?

Here is the code:



Thanks!


Rodrigo

unread,
Dec 17, 2020, 2:01:34 PM12/17/20
to mockito
This is the code:

    Invoker invoker = mock(Invoker.class);
    HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
    Abcd abcd = mock(Abcd.class);
    MyRepository myRepository = mock(MyRepository.class);


    @BeforeEach
    void before(PactVerificationContext context) {

        doAnswer((invocation) -> {
                    XptoClassOutputBoundary test = invocation.getArgumentAt(1, XptoClassOutputBoundary.class);
                    test.getResponse().setValue(new BigDecimal("500"));
                    return null;
                }
        ).when(myRepository).execute(any(), any());
Reply all
Reply to author
Forward
0 new messages