Java Code Examples for org.mockito.junit.MockitoJUnit

The following examples show how to use org.mockito.junit.MockitoJUnit. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: tutorials   Source File: LazyVerificationUnitTest.java    License: MIT License 6 votes vote down vote up
@Test
public void whenLazilyVerified_thenReportsMultipleFailures() {
    VerificationCollector collector = MockitoJUnit.collector()
        .assertLazily();

    List mockList = mock(List.class);
    verify(mockList).add("one");
    verify(mockList).clear();

    try {
        collector.collectAndReport();
    } catch (MockitoAssertionError error) {
        assertTrue(error.getMessage()
            .contains("1. Wanted but not invoked:"));
        assertTrue(error.getMessage()
            .contains("2. Wanted but not invoked:"));
    }
}