JavaSnippetExecutor extends AbstractSnippetExecutor<JavaSnippetExecutorOptions> { protected String formatImportLine(final String importLine) { final String importLineBeginning = "import "; final String importLineEnding = ";"; String formattedImportLine; if (importLine.startsWith(importLineBeginning)) { formattedImportLine = importLine; } else { formattedImportLine = importLineBeginning.concat(importLine); } if (!importLine.endsWith(importLineEnding)) { formattedImportLine = formattedImportLine.concat(importLineEnding); } return formattedImportLine; } JavaSnippetExecutor(); @Override Parent getUI(final CodeSnippet codeSnippet); @Override Node getConfigurationUI(); @Override void saveNewOptions(); @Override ObservableList<String> execute(final CodeSnippet codeSnippet);  }
@Test public void formatImportWithoutImportKeyword() { assertEquals("import mypackage;", snippetExecutor.formatImportLine("mypackage")); }
@Test public void formatImportWithImportKeyword() { assertEquals("import mypackage;", snippetExecutor.formatImportLine("import mypackage;")); }
@Test public void formatImportWithImportKeywordAndWithoutColumn() { assertEquals("import mypackage;", snippetExecutor.formatImportLine("import mypackage")); }