Apex extends AbstractLanguage { @Override public String[] getFileSuffixes() { String[] suffixes = filterEmptyStrings(settings.getStringArray(FILE_SUFFIXES_KEY)); return suffixes.length == 0 ? DEFAULT_FILE_SUFFIXES : suffixes; } Apex(Settings settings); @Override String[] getFileSuffixes(); static final String FILE_SUFFIXES_KEY; static final String[] DEFAULT_FILE_SUFFIXES; static final String NAME; static final String KEY; }
@Test public void testApexProperties() { assertThat(apexLanguage.getKey(), is("apex")); assertThat(apexLanguage.getName(), is("Apex")); assertThat(apexLanguage.getFileSuffixes(), is(new String[]{"cls", "trigger"})); }
@Test public void testCustomFileSuffixes() { Map<String, String> props = Maps.newHashMap(); props.put(Apex.FILE_SUFFIXES_KEY, "cls,apex"); Settings settings = new Settings(); settings.addProperties(props); assertThat(apexLanguage.getFileSuffixes(), is(new String[]{"cls", "trigger"})); }