JavaSnippetExecutor extends AbstractSnippetExecutor<JavaSnippetExecutorOptions> { protected String determineClassName(final CodeSnippet codeSnippet) { String className = codeSnippet.getProperties().get(CLASS_NAME_PROPERTY); if (className == null || className.isEmpty()) className = "Snippet"; return className; } JavaSnippetExecutor(); @Override Parent getUI(final CodeSnippet codeSnippet); @Override Node getConfigurationUI(); @Override void saveNewOptions(); @Override ObservableList<String> execute(final CodeSnippet codeSnippet);  }
@Test public void noClassName() { final CodeSnippet snippet = new CodeSnippet(); assertEquals("Snippet", snippetExecutor.determineClassName(snippet)); }
@Test public void emptyClassName() { final CodeSnippet snippet = new CodeSnippet(); snippet.getProperties().put(CLASS_NAME_PROPERTY, ""); assertEquals("Snippet", snippetExecutor.determineClassName(snippet)); }
@Test public void givenClassName() { final CodeSnippet snippet = new CodeSnippet(); snippet.getProperties().put(CLASS_NAME_PROPERTY, "JavaTest"); assertEquals("JavaTest", snippetExecutor.determineClassName(snippet)); }