ScalaSnippetExecutor extends AbstractSnippetExecutor<ScalaSnippetExecutorOptions> { protected String getImports(final CodeSnippet codeSnippet) throws IOException { final StringJoiner imports = new StringJoiner("\n"); try (final StringReader stringReader = new StringReader(codeSnippet.getProperties().get(IMPORTS_PROPERTY)); final BufferedReader reader = new DefaultCharsetReader(stringReader)) { reader.lines() .filter(line -> !line.trim().isEmpty()) .forEach(line -> imports.add(formatImportLine(line))); } return imports.toString(); } ScalaSnippetExecutor(); @Override Parent getUI(final CodeSnippet codeSnippet); @Override Node getConfigurationUI(); @Override void saveNewOptions(); @Override ObservableList<String> execute(final CodeSnippet codeSnippet);  }
@Test public void importsWithAndWithoutKeyword() throws IOException { final CodeSnippet snippet = new CodeSnippet(); snippet.getProperties().put(IMPORTS_PROPERTY, "import mypackage\nmysecondpackage"); assertEquals("import mypackage\nimport mysecondpackage", snippetExecutor.getImports(snippet)); }