Ive been trying to mock a final class(Paths)
@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();
}
But I keep getting this error
org.mockito.exceptions.misusing.MissingMethodInvocationException: when() requires an argument which has to be 'a method call on a mock'. For example: when(mock.getArticles()).thenReturn(articles);
I don't want to do a Paths.get() of the actual path because the test keeps on hanging because its listening to the actual class