GoSnippetExecutor extends AbstractSnippetExecutor<GoSnippetExecutorOptions> { 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("\t".concat(formatImportLine(line)))); } return "import (\n".concat(imports.toString()).concat("\n)"); } GoSnippetExecutor(); @Override Parent getUI(final CodeSnippet codeSnippet); @Override Node getConfigurationUI(); @Override void saveNewOptions(); @Override ObservableList<String> execute(final CodeSnippet codeSnippet);  }
@Test public void importsWithAndWithoutDoubleQuotes() throws IOException { final CodeSnippet snippet = new CodeSnippet(); snippet.getProperties().put(IMPORTS_PROPERTY, "\"mypackage\"\nmysecondpackage"); assertEquals("import (\n\t\"mypackage\"\n\t\"mysecondpackage\"\n)", snippetExecutor.getImports(snippet)); }