why the mockito spy not working for idea debug?

Viewed 8

when i use idea2017.3 for mockito 3.8 and mocktio-inline, here is my code , the test is passed, but i cannot debug into this 'doA' method

@Service
public class TestClass{
    public int doA(){
        log.info("AAAA ----"); // i debug here , but not work
        int a = 1+doB();
        log.info("-----AAAA ----"+a);
        return a;
    }

    public int doB(){
        log.info("doB:2222");
        return 2;
    }
}

// here is my test class

    @InjectMocks
    private TestClass testClass;

    @Test
    public void testDoA() {
        // Setup

        // Run the test
        TestClass spy = spy(testClass);
        doReturn(5).when(spy).doB();
        final int result = spy.doA();

        // Verify the results 
        assertEquals(6, result);   
    }

0 Answers
Related