Groovy extends AbstractLanguage { @Override public String[] getFileSuffixes() { String[] suffixes = filterEmptyStrings(settings.getStringArray(GroovyPlugin.FILE_SUFFIXES_KEY)); if (suffixes.length == 0) { suffixes = StringUtils.split(GroovyPlugin.DEFAULT_FILE_SUFFIXES, ","); } return addDot(suffixes); } Groovy(Settings settings); @Override String[] getFileSuffixes(); static final String KEY; }
@Test public void test() { Settings settings = new Settings(); Groovy language = new Groovy(settings); assertThat(language.getKey()).isEqualTo("grvy"); assertThat(language.getName()).isEqualTo("Groovy"); assertThat(language.getFileSuffixes()).isEqualTo(new String[] {".groovy"}); settings.setProperty(GroovyPlugin.FILE_SUFFIXES_KEY, ""); assertThat(language.getFileSuffixes()).containsOnly(".groovy"); settings.setProperty(GroovyPlugin.FILE_SUFFIXES_KEY, ".groovy, .grvy"); assertThat(language.getFileSuffixes()).containsOnly(".groovy", ".grvy"); }