Fix controller test

This commit is contained in:
Oystein Kristoffer Tveit 2021-04-20 12:23:40 +02:00
parent 59a45ba4a5
commit d4d6be1930
1 changed files with 3 additions and 2 deletions

View File

@ -90,12 +90,13 @@ public class EditorControllerTest extends FxTestTemplate {
String filePath = getClass().getResource(resourcePath).getPath();
File file = new File(filePath);
eventBus.post(new FileSelectedEvent(file.toPath()));
try (MockedStatic<FileOperations> mocked = mockStatic(FileOperations.class)) {
mocked.when(() -> FileOperations.readFile(any()))
.thenReturn("");
mocked.verify(() -> FileOperations.readFile(file.toPath()));
eventBus.post(new FileSelectedEvent(file.toPath()));
mocked.verify(() -> FileOperations.readFile(any()));
}
}