Make nullable paths explicitly nullable
This commit is contained in:
@@ -2,9 +2,7 @@ package app.controllers;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.fxmisc.richtext.CodeArea;
|
||||
import org.fxmisc.richtext.model.StyleSpans;
|
||||
@@ -16,7 +14,6 @@ import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
@@ -94,7 +91,7 @@ public class EditorControllerTest extends FxTestTemplate {
|
||||
mocked.when(() -> FileOperations.readFile(any()))
|
||||
.thenReturn("");
|
||||
|
||||
eventBus.post(new FileSelectedEvent(file.toPath()));
|
||||
eventBus.post(new FileSelectedEvent(Optional.of(file.toPath())));
|
||||
|
||||
mocked.verify(() -> FileOperations.readFile(any()));
|
||||
}
|
||||
@@ -105,7 +102,7 @@ public class EditorControllerTest extends FxTestTemplate {
|
||||
public void testFileSelectedEventWithUnrealFile() throws IOException {
|
||||
|
||||
String brokenFilePath = "/doesNotExist.txt";
|
||||
eventBus.post(new FileSelectedEvent(new File(brokenFilePath).toPath()));
|
||||
eventBus.post(new FileSelectedEvent(Optional.ofNullable(new File(brokenFilePath).toPath())));
|
||||
|
||||
verify(editor, never()).clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user