use of org.mockito.invocation.Invocation in project mockito by mockito.
the class NoMoreInteractionsTest method shouldVerifyInOrderAndPass.
@Test
public void shouldVerifyInOrderAndPass() {
//given
NoMoreInteractions n = new NoMoreInteractions();
Invocation i = new InvocationBuilder().toInvocation();
context.markVerified(i);
assertTrue(context.isVerified(i));
//when
n.verifyInOrder(new VerificationDataInOrderImpl(context, asList(i), null));
//then no exception is thrown
}
use of org.mockito.invocation.Invocation in project mockito by mockito.
the class InvocationMarkerTest method shouldMarkInvocationAsVerified.
@Test
public void shouldMarkInvocationAsVerified() {
//given
Invocation i = new InvocationBuilder().toInvocation();
InvocationMatcher im = new InvocationBuilder().toInvocationMatcher();
assertFalse(i.isVerified());
//when
InvocationMarker.markVerified(Arrays.asList(i), im);
//then
assertTrue(i.isVerified());
}
use of org.mockito.invocation.Invocation in project mockito by mockito.
the class InvocationMatcherTest method should_not_be_similar_to_verified_invocation.
@Test
public void should_not_be_similar_to_verified_invocation() throws Exception {
Invocation verified = new InvocationBuilder().simpleMethod().verified().toInvocation();
assertFalse(simpleMethod.hasSimilarMethod(verified));
}
use of org.mockito.invocation.Invocation in project mockito by mockito.
the class InvocationMatcherTest method should_be_similar_if_is_overloaded_but_used_with_different_arg.
@Test
public void should_be_similar_if_is_overloaded_but_used_with_different_arg() throws Exception {
Method method = IMethods.class.getMethod("simpleMethod", String.class);
Method overloadedMethod = IMethods.class.getMethod("simpleMethod", Object.class);
InvocationMatcher invocation = new InvocationBuilder().mock(mock).method(method).arg("foo").toInvocationMatcher();
Invocation overloadedInvocation = new InvocationBuilder().mock(mock).method(overloadedMethod).arg("bar").toInvocation();
assertTrue(invocation.hasSimilarMethod(overloadedInvocation));
}
use of org.mockito.invocation.Invocation in project mockito by mockito.
the class InvocationMatcherTest method should_be_a_citizen_of_hashes.
@Test
public void should_be_a_citizen_of_hashes() throws Exception {
Invocation invocation = new InvocationBuilder().toInvocation();
Invocation invocationTwo = new InvocationBuilder().args("blah").toInvocation();
Map<InvocationMatcher, String> map = new HashMap<InvocationMatcher, String>();
map.put(new InvocationMatcher(invocation), "one");
map.put(new InvocationMatcher(invocationTwo), "two");
assertEquals(2, map.size());
}
Aggregations