Python extends AbstractLanguage { @Override public String[] getFileSuffixes() { String[] suffixes = filterEmptyStrings(configuration.getStringArray(PythonPlugin.FILE_SUFFIXES_KEY)); return suffixes.length == 0 ? Python.DEFAULT_FILE_SUFFIXES : suffixes; } Python(Configuration configuration); @Override String[] getFileSuffixes(); static final String KEY; }
@Test public void test() { Python language = new Python(new ConfigurationBridge(new MapSettings())); assertThat(language.getKey()).isEqualTo("py"); assertThat(language.getName()).isEqualTo("Python"); assertThat(language.getFileSuffixes()).hasSize(1).contains("py"); }
@Test public void custom_file_suffixes() { MapSettings settings = new MapSettings(); settings.setProperty(PythonPlugin.FILE_SUFFIXES_KEY, "py,python"); Python language = new Python(new ConfigurationBridge(settings)); assertThat(language.getFileSuffixes()).hasSize(2).contains("python"); }