Flush
This commit is contained in:
@@ -2,6 +2,7 @@ package app.controllers;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.fxmisc.richtext.CodeArea;
|
||||
@@ -100,11 +101,15 @@ public class EditorControllerTest extends FxTestTemplate {
|
||||
@Test
|
||||
@DisplayName("Test handling of OpenFileEvent with a file that doesn't exist")
|
||||
public void testOpenFileEventWithUnrealFile() throws IOException {
|
||||
try (MockedStatic<FileOperations> mocked = mockStatic(FileOperations.class)) {
|
||||
mocked.when(() -> FileOperations.readFile(any()))
|
||||
.thenReturn(null);
|
||||
|
||||
String brokenFilePath = "/doesNotExist.txt";
|
||||
eventBus.post(new OpenFileEvent(Optional.ofNullable(new File(brokenFilePath).toPath())));
|
||||
String brokenFilePath = "/doesNotExist.txt";
|
||||
eventBus.post(new OpenFileEvent(Optional.ofNullable(Paths.get(brokenFilePath))));
|
||||
|
||||
verify(editor, never()).clear();
|
||||
verify(editor, never()).clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user