Search in sources :

Example 6 with Equals

use of org.mockito.internal.matchers.Equals in project mockito by mockito.

the class InvocationMatcherTest method should_to_string_with_matchers.

@Test
public void should_to_string_with_matchers() throws Exception {
    ArgumentMatcher m = NotNull.NOT_NULL;
    InvocationMatcher notNull = new InvocationMatcher(new InvocationBuilder().toInvocation(), asList(m));
    ArgumentMatcher mTwo = new Equals('x');
    InvocationMatcher equals = new InvocationMatcher(new InvocationBuilder().toInvocation(), asList(mTwo));
    assertThat(notNull.toString()).contains("simpleMethod(notNull())");
    assertThat(equals.toString()).contains("simpleMethod('x')");
}
Also used : Equals(org.mockito.internal.matchers.Equals) TestCase.assertEquals(junit.framework.TestCase.assertEquals) ArgumentMatcher(org.mockito.ArgumentMatcher) Test(org.junit.Test)

Example 7 with Equals

use of org.mockito.internal.matchers.Equals in project mockito by mockito.

the class InvocationMatcherTest method should_capture_arguments_from_invocation.

@Test
public void should_capture_arguments_from_invocation() throws Exception {
    //given
    Invocation invocation = new InvocationBuilder().args("1", 100).toInvocation();
    CapturingMatcher capturingMatcher = new CapturingMatcher();
    InvocationMatcher invocationMatcher = new InvocationMatcher(invocation, (List) asList(new Equals("1"), capturingMatcher));
    //when
    invocationMatcher.captureArgumentsFrom(invocation);
    //then
    assertEquals(1, capturingMatcher.getAllValues().size());
    assertEquals(100, capturingMatcher.getLastValue());
}
Also used : Equals(org.mockito.internal.matchers.Equals) TestCase.assertEquals(junit.framework.TestCase.assertEquals) Invocation(org.mockito.invocation.Invocation) CapturingMatcher(org.mockito.internal.matchers.CapturingMatcher) Test(org.junit.Test)

Example 8 with Equals

use of org.mockito.internal.matchers.Equals in project jackrabbit-oak by apache.

the class TestS3Ds method testUpdateLastModifiedOnAccess.

/**----------Only run with org.apache.jackrabbit.oak.blob.cloud.aws.s3.S3DataStore-----------**/
@Override
public void testUpdateLastModifiedOnAccess() {
    Assume.assumeThat(s3Class, new Equals(fixtures().get(1)));
    super.testUpdateLastModifiedOnAccess();
}
Also used : Equals(org.mockito.internal.matchers.Equals)

Example 9 with Equals

use of org.mockito.internal.matchers.Equals in project jackrabbit-oak by apache.

the class TestS3Ds method testDeleteAllOlderThan.

@Override
public void testDeleteAllOlderThan() {
    Assume.assumeThat(s3Class, new Equals(fixtures().get(1)));
    super.testDeleteAllOlderThan();
}
Also used : Equals(org.mockito.internal.matchers.Equals)

Aggregations

Equals (org.mockito.internal.matchers.Equals)9 Test (org.junit.Test)7 TestCase.assertEquals (junit.framework.TestCase.assertEquals)6 ArgumentMatcher (org.mockito.ArgumentMatcher)2 CapturingMatcher (org.mockito.internal.matchers.CapturingMatcher)2 Invocation (org.mockito.invocation.Invocation)2 Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1