Search in sources :

Example 1 with ArgumentsAreDifferent

use of org.mockito.exceptions.verification.junit.ArgumentsAreDifferent in project mockito by mockito.

the class VerificationOverTimeImplTest method should_deal_with_junit_assertion_error.

@Test
public void should_deal_with_junit_assertion_error() {
    ArgumentsAreDifferent toBeThrown = new ArgumentsAreDifferent("message", "wanted", "actual");
    exception.expect(is(toBeThrown));
    exception.expectMessage("message");
    doThrow(toBeThrown).when(delegate).verify(null);
    impl.verify(null);
}
Also used : ArgumentsAreDifferent(org.mockito.exceptions.verification.junit.ArgumentsAreDifferent) Test(org.junit.Test)

Example 2 with ArgumentsAreDifferent

use of org.mockito.exceptions.verification.junit.ArgumentsAreDifferent in project mockito by mockito.

the class PrintingVerboseTypesWithArgumentsTest method should_not_show_types_when_types_are_the_same_even_if_to_string_gives_the_same_result.

@Test
public void should_not_show_types_when_types_are_the_same_even_if_to_string_gives_the_same_result() {
    //given
    IMethods mock = mock(IMethods.class);
    mock.simpleMethod(new Foo(10));
    try {
        //when
        verify(mock).simpleMethod(new Foo(20));
        fail();
    } catch (ArgumentsAreDifferent e) {
        //then
        assertThat(e).hasMessageContaining("simpleMethod(foo)");
    }
}
Also used : ArgumentsAreDifferent(org.mockito.exceptions.verification.junit.ArgumentsAreDifferent) IMethods(org.mockitousage.IMethods) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ArgumentsAreDifferent (org.mockito.exceptions.verification.junit.ArgumentsAreDifferent)2 IMethods (org.mockitousage.IMethods)1