use of com.qlangtech.tis.offline.FileSystemFactory in project tis by qlangtech.
the class MockTest method testMock.
public void testMock() {
final String fsPath = "/user/admin/test";
FileSystemFactory indexBuilderFileSystemFactory = EasyMock.createMock("indexBuildFileSystem", FileSystemFactory.class);
ITISFileSystem tisFileSystem = EasyMock.createMock("tisFileSystem", ITISFileSystem.class);
EasyMock.expect(tisFileSystem.getName()).andReturn("mocktest");
IPath path = EasyMock.createMock("mockpath", IPath.class);
EasyMock.expect(tisFileSystem.getPath(fsPath)).andReturn(path);
EasyMock.expect(indexBuilderFileSystemFactory.getFileSystem()).andReturn(tisFileSystem);
EasyMock.replay(indexBuilderFileSystemFactory, tisFileSystem, path);
ITISFileSystem fs = indexBuilderFileSystemFactory.getFileSystem();
assertEquals("mocktest", fs.getName());
assertNotNull(fs.getPath(fsPath));
}
Aggregations