@Disabled("Does not work on headless servers") @Test void testSaveText(final FxRobot robot, @TempDir final Path tempDir) throws IOException { final Path path = tempDir.resolve("test.txt"); final File file = path.toFile(); final FileChooser mockChooser = Mockito.mock(FileChooser.class); Mockito.when(mockChooser.showSaveDialog(null)).thenReturn(file); spoonCodeInstrument.setFileChooser(mockChooser); robot.clickOn(spoonCode).write("class Foo { int i; }"); waitForTimeoutTransitions(); final Button save = robot.lookup("#save").query(); robot.clickOn(save); WaitForAsyncUtils.waitForFxEvents(); final List<String> lines = Files.readAllLines(path); assertThat(lines.size()).isEqualTo(3); assertThat(lines.get(0)).contains("CtClass"); assertThat(lines).noneMatch(l -> l.contains("TextFlow@")); }
void setFileChooser(final FileChooser fileChooser) { this.fileChooser = fileChooser; }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void setFileChooser(final FileChooser fileChooser) { this.fileChooser = fileChooser; } }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void setFileChooser(final FileChooser fileChooser) { this.fileChooser = fileChooser; }  }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void setFileChooser(final FileChooser fileChooser) { this.fileChooser = fileChooser; }  @Override void initialize(final URL url, final ResourceBundle res); }
SpoonCodeInstrument extends JfxInstrument implements Initializable { void setFileChooser(final FileChooser fileChooser) { this.fileChooser = fileChooser; }  @Override void initialize(final URL url, final ResourceBundle res);  }