我一直试图模拟最后一堂课(路径)
@Test
public void testShouldCheckIfThereAreAnyChangesInTheFolder() throws Exception {
Paths paths = PowerMockito.mock(Paths.class);
Mockito.when(Paths.get("test/test/test")).thenReturn(path);
fileSystem = path.getFileSystem();
WatchService watchService = fileSystem.newWatchService();
fileWatcher = new FileWatcher(path, fileSystem, watchService);
fileWatcher.listenToFolderChanges();
}
但我一直收到这个错误
org.mockito.exceptions.misusing.MissingMethodInvocationException: when()需要一个必须是'对mock进行方法调用'的参数。 例如: 当(mock.getArticles())thenReturn(文章);
我不想做实际路径的Paths.get(),因为测试一直挂着,因为它听实际的类