MapFileRepositoryCustoImplTest.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:osiris 作者:
@Test
public void getFileMapByAppId() throws Exception{

    //Fixture
    Mockito.when(mongoTemplate.getDb()).thenReturn(db);
    PowerMockito.whenNew(GridFS.class).withArguments(db,collectionNameMap).thenReturn(gridFS);      
    Mockito.when(gridFS.findOne(idApp)).thenReturn(gridFSFile);
    Mockito.when(gridFSFile.getInputStream()).thenReturn(inputStream);

    // Experimentations
    InputStream response=mapFileRepositoryCustomImpl.getMapFileByAppId(idApp);

    // Expectations
    Mockito.verify(gridFS).findOne(idApp);
    Mockito.verify(gridFSFile).getInputStream();
    Assert.assertEquals("File .map must be the same",inputStream,response);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号