JavaScriptLanguage extends AbstractLanguage { @Override public String[] getFileSuffixes() { return configuration.getStringArray(FILE_SUFFIXES_KEY); } JavaScriptLanguage(Configuration configuration); @Override String[] getFileSuffixes(); static final String KEY; }
@Test public void defaultSuffixes() { MapSettings mapSettings = new MapSettings(); mapSettings.setProperty(JavaScriptLanguage.FILE_SUFFIXES_KEY, JavaScriptLanguage.FILE_SUFFIXES_DEFVALUE); JavaScriptLanguage javaScriptLanguage = new JavaScriptLanguage(mapSettings.asConfig()); assertThat(javaScriptLanguage.getFileSuffixes()).containsOnly(".js", ".jsx", ".vue"); }
@Test public void customSuffixes() { MapSettings mapSettings = new MapSettings(); mapSettings.setProperty(JavaScriptLanguage.FILE_SUFFIXES_KEY, "javascript"); JavaScriptLanguage javaScriptLanguage = new JavaScriptLanguage(mapSettings.asConfig()); assertThat(javaScriptLanguage.getFileSuffixes()).containsOnly("javascript"); }