use of org.mockito.junit.VerificationCollector in project mockito by mockito.
the class VerificationCollectorImplTest method should_collect_multiple_verification_failures.
@Test
public void should_collect_multiple_verification_failures() {
VerificationCollector collector = MockitoJUnit.collector().assertLazily();
IMethods methods = mock(IMethods.class);
verify(methods).simpleMethod();
verify(methods).byteReturningMethod();
try {
collector.collectAndReport();
fail();
} catch (MockitoAssertionError error) {
assertThat(error).hasMessageContaining("1. Wanted but not invoked:");
assertThat(error).hasMessageContaining("2. Wanted but not invoked:");
}
}
use of org.mockito.junit.VerificationCollector in project mockito by mockito.
the class VerificationCollectorImplTest method should_collect_verification_failures.
@Test(expected = MockitoAssertionError.class)
public void should_collect_verification_failures() {
VerificationCollector collector = MockitoJUnit.collector().assertLazily();
IMethods methods = mock(IMethods.class);
verify(methods).simpleMethod();
collector.collectAndReport();
}
use of org.mockito.junit.VerificationCollector in project mockito by mockito.
the class VerificationCollectorImplTest method should_continue_collecting_after_failing_verification.
@Test
public void should_continue_collecting_after_failing_verification() {
VerificationCollector collector = MockitoJUnit.collector().assertLazily();
IMethods methods = mock(IMethods.class);
methods.simpleMethod();
verify(methods).byteReturningMethod();
verify(methods).simpleMethod();
this.assertAtLeastOneFailure(collector);
}
use of org.mockito.junit.VerificationCollector in project mockito by mockito.
the class VerificationCollectorImplTest method should_only_collect_failures_ignore_succesful_verifications.
@Test
public void should_only_collect_failures_ignore_succesful_verifications() {
VerificationCollector collector = MockitoJUnit.collector().assertLazily();
IMethods methods = mock(IMethods.class);
verify(methods, never()).simpleMethod();
verify(methods).byteReturningMethod();
this.assertAtLeastOneFailure(collector);
}
use of org.mockito.junit.VerificationCollector in project mockito by mockito.
the class VerificationCollectorImplTest method should_not_throw_any_exceptions_when_verifications_are_succesful.
@Test
public void should_not_throw_any_exceptions_when_verifications_are_succesful() {
VerificationCollector collector = MockitoJUnit.collector().assertLazily();
IMethods methods = mock(IMethods.class);
methods.simpleMethod();
verify(methods).simpleMethod();
collector.collectAndReport();
}
Aggregations