Search in sources :

Example 1 with MockitoSessionLogger

use of org.mockito.session.MockitoSessionLogger in project mockito by mockito.

the class DefaultMockitoSessionBuilderTest method uses_logger_and_strictness.

@Test
public void uses_logger_and_strictness() {
    TestClass testClass = new TestClass();
    final List<String> hints = new ArrayList<String>();
    MockitoSession session = new DefaultMockitoSessionBuilder().initMocks(testClass).strictness(WARN).logger(new MockitoSessionLogger() {

        @Override
        public void log(String hint) {
            hints.add(hint);
        }
    }).startMocking();
    when(testClass.set.add(1)).thenReturn(true);
    session.finishMocking();
    assertFalse(hints.isEmpty());
}
Also used : MockitoSession(org.mockito.MockitoSession) MockitoSessionLogger(org.mockito.session.MockitoSessionLogger) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 MockitoSession (org.mockito.MockitoSession)1 MockitoSessionLogger (org.mockito.session.MockitoSessionLogger)1