use of org.mockito.internal.invocation.InvocationMatcher in project mockito by mockito.
the class OnlyTest method shouldMarkAsVerified.
@Test
public void shouldMarkAsVerified() {
// given
Invocation invocation = new InvocationBuilder().toInvocation();
assertFalse(invocation.isVerified());
// when
only.verify(new VerificationDataStub(new InvocationMatcher(invocation), invocation));
// then
assertTrue(invocation.isVerified());
}
use of org.mockito.internal.invocation.InvocationMatcher in project mockito by mockito.
the class SmartPrinterTest method setup.
@Before
public void setup() throws Exception {
mock.varargs("first very long argument", "second very long argument", "another very long argument");
multi = new InvocationMatcher(getLastInvocation());
mock.varargs("short arg");
shortie = new InvocationMatcher(getLastInvocation());
}
use of org.mockito.internal.invocation.InvocationMatcher in project mockito by mockito.
the class VerificationDataImplTest method shouldToStringBeNotVerifiable.
@Test
public void shouldToStringBeNotVerifiable() throws Exception {
InvocationMatcher toString = new InvocationBuilder().method("toString").toInvocationMatcher();
try {
new VerificationDataImpl(null, toString);
fail();
} catch (MockitoException e) {
}
}
use of org.mockito.internal.invocation.InvocationMatcher in project mockito by mockito.
the class AtLeastXNumberOfInvocationsCheckerTest method shouldReportTooFewInvocations.
@Test
public void shouldReportTooFewInvocations() {
// given
Invocation invocation = new InvocationBuilder().simpleMethod().toInvocation();
Invocation invocationTwo = new InvocationBuilder().differentMethod().toInvocation();
// when
assertThatThrownBy(() -> {
checkAtLeastNumberOfInvocations(asList(invocation, invocationTwo), new InvocationMatcher(invocation), 2);
}).isInstanceOf(TooFewActualInvocations.class).hasMessageContainingAll("iMethods.simpleMethod();", "Wanted *at least* 2 times", "But was 1 time");
}
use of org.mockito.internal.invocation.InvocationMatcher in project mockito by mockito.
the class InvocationContainerImplTest method should_return_invoked_mock_stub_only.
@Test
public void should_return_invoked_mock_stub_only() throws Exception {
containerStubOnly.setInvocationForPotentialStubbing(new InvocationMatcher(invocation));
assertEquals(invocation.getMock(), containerStubOnly.invokedMock());
}
Aggregations