org.mockito.internal.matchers.InstanceOf的实例源码

项目:samBox    文件PDDocumentWriterTest.java   
@Test
public void writeBodySync() throws Exception
{
    PDDocument document = mock(PDDocument.class);
    COSDocument cosDoc = mock(COSDocument.class);
    FileTrailer trailer = new FileTrailer();
    when(document.getDocument()).thenReturn(cosDoc);
    when(cosDoc.getTrailer()).thenReturn(trailer);
    this.victim = new PDDocumentWriter(from(new DevNullWritableByteChannel()),null,WriteOption.SYNC_BODY_WRITE);
    TestUtils.setProperty(victim,"writer",this.writer);
    ArgumentCaptor<PDFBodyWriter> bodyWriter = ArgumentCaptor.forClass(PDFBodyWriter.class);
    victim.write(document);
    verify(cosDoc).accept(bodyWriter.capture());
    assertthat(bodyWriter.getValue().objectsWriter,new InstanceOf(SyncPDFBodyObjectsWriter.class));
}
项目:samBox    文件PDDocumentWriterTest.java   
@Test
public void writeBodyCompressed() throws Exception
{
    PDDocument document = mock(PDDocument.class);
    COSDocument cosDoc = mock(COSDocument.class);
    FileTrailer trailer = new FileTrailer();
    when(document.getDocument()).thenReturn(cosDoc);
    when(cosDoc.getTrailer()).thenReturn(trailer);
    this.victim = new PDDocumentWriter(from(new DevNullWritableByteChannel()),WriteOption.SYNC_BODY_WRITE,WriteOption.OBJECT_STREAMS);
    TestUtils.setProperty(victim,new InstanceOf(ObjectsstreamPDFBodyObjectsWriter.class));
}
项目:joynr    文件JoynrEnd2EndTest.java   
public JoynrEnd2Endtest() {
    Answer<AbstractSubscriptionPublisher> answer = new Answer<AbstractSubscriptionPublisher>() {

        @Override
        public AbstractSubscriptionPublisher answer(InvocationOnMock invocation) throws Throwable {
            Object provider = invocation.getArguments()[0];
            if (provider instanceof testProvider) {
                ((testProvider) provider).setSubscriptionPublisher(testSubscriptionPublisher);
            }
            return testSubscriptionPublisher;
        }
    };
    Mockito.doAnswer(answer)
           .when(subscriptionPublisherFactory)
           .create((JoynrProvider) Mockito.argThat(new InstanceOf(testProvider.class)));
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testGetNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.get(null,SimpleObject.class);
        fail("Should throw an exception");
    } catch (Exception e) {
        assertthat(e,new InstanceOf(IllegalArgumentException.class));
        assertEquals("key is null or empty",e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testGetNullType() throws Exception {
    bucket = createCache();

    try {
        bucket.get("TEST_KEY",null);
        fail("Should throw an exception");
    } catch (Exception e) {
        assertthat(e,new InstanceOf(IllegalArgumentException.class));
        assertEquals("typeOfT is null",e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testPutNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.put(null,new SimpleObject("TEST_VALUE"));
        fail("Should throw an exception");
    } catch (Exception e) {
        assertthat(e,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testPutNullObject() throws Exception {
    bucket = createCache();

    try {
        bucket.put("TEST_KEY",new InstanceOf(IllegalArgumentException.class));
        assertEquals("object is null",e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testContainsNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.contains(null);
        fail("Should throw an exception");
    } catch (Exception e) {
        assertthat(e,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testRemoveNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.remove(null);
        fail("Should throw an exception");
    } catch (Exception e) {
        assertthat(e,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testGetAsyncNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.getAsync(null,SimpleObject.class,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testGetAsyncNullType() throws Exception {
    bucket = createCache();

    try {
        bucket.getAsync("TEST_KEY",e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testPutAsyncNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.putAsync(null,new SimpleObject("TEST_VALUE"),e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testPutAsyncNullObject() throws Exception {
    bucket = createCache();

    try {
        bucket.putAsync("TEST_KEY",e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testContainsAsyncNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.containsAsync(null,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testRemoveAsyncNullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.removeAsync(null,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testGetRxKey() throws Exception {
    bucket = createCache();

    try {
        bucket.getRx(null,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testGetRxnullType() throws Exception {
    bucket = createCache();

    try {
        bucket.getRx("TEST_KEY",e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testPutRxnullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.putRx(null,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testPutRxnullObject() throws Exception {
    bucket = createCache();

    try {
        bucket.putRx("TEST_KEY",e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testContainsRxnullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.containsRx(null);
        fail("Should throw an exception");
    } catch (Exception e) {
        assertthat(e,e.getMessage());
    }
}
项目:Bucket    文件BucketArgsTest.java   
@Test
public void testRemoveRxnullKey() throws Exception {
    bucket = createCache();

    try {
        bucket.removeRx(null);
        fail("Should throw an exception");
    } catch (Exception e) {
        assertthat(e,e.getMessage());
    }
}
项目:samBox    文件PDDocumentWriterTest.java   
@Test
public void writeBodyAsync() throws Exception
{
    PDDocument document = mock(PDDocument.class);
    COSDocument cosDoc = mock(COSDocument.class);
    FileTrailer trailer = new FileTrailer();
    when(document.getDocument()).thenReturn(cosDoc);
    when(cosDoc.getTrailer()).thenReturn(trailer);
    ArgumentCaptor<PDFBodyWriter> bodyWriter = ArgumentCaptor.forClass(PDFBodyWriter.class);
    victim.write(document);
    verify(cosDoc).accept(bodyWriter.capture());
    assertthat(bodyWriter.getValue().objectsWriter,new InstanceOf(AsyncPDFBodyObjectsWriter.class));
}
项目:Rando-android    文件UserFetchResultListenerTest.java   
@Test
public void testFetchUserInRandosParsing() throws Exception {
    OnFetchUser onFetchUseMock = spy(new OnFetchUserAssertions());
    new UserFetchResultListener(context,onFetchUseMock).onResponse(APITestHelper.getUserFetchJSONObject());
    verify(onFetchUseMock,times(1)).onFetch((User) argThat(new InstanceOf(User.class)));
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...