### Question:
TextRuleList extends AbstractRulesList { public boolean existsClass(Filter filter, String lang) { for (int i = 0; i < countClasses(); i++) { if (getClassLang(i) == null && lang != null) continue; if (getClassLang(i) != null && !getClassLang(i).equals(lang)) continue; if (filter != null && getClassFilter(i).toString().equals(filter.toString())) return true; } return false; } TextRuleList(StyledFeaturesInterface<?> styledFeatures,
			boolean withDefaults);  TextRuleList(StyledFeaturesInterface<?> styledFeatures,
			GeometryForm geometryForm, boolean withDefaults); static Filter classLanguageFilter(String lang); int addClass(TextSymbolizer ts, String ruleName, Filter filter,
			boolean enabled, String lang, Double minScale, Double maxScale); int addDefaultClass(); int addDefaultClass(String lang); int countClasses(); boolean existsClass(Filter filter, String lang); Filter getClassFilter(int index); String getClassLang(int index); TextSymbolizer getClassSymbolizer(int index); ArrayList<String> getDefaultLanguages(); @Deprecated String getRuleName(); String getRuleName(int index); List<String> getRuleNames(); @Override List<Rule> getRules(); @Deprecated int getSelIdx(); StyledFeaturesInterface<?> getStyledFeatures(); @Deprecated TextSymbolizer getSymbolizer(); List<TextSymbolizer> getSymbolizers(); boolean hasDefault(); void importClassesFromStyle(RulesListInterface symbRL,
			Component owner); @Override void importRules(List<Rule> rules); Boolean isClassEnabled(int index); @Override void parseMetaInfoString(String metaInfoString, FeatureTypeStyle fts); void removeClass(int idx); void removeClassEnabled(int classIdx); void removeClassMaxScale(int classIdx); void removeClassMinScale(int classIdx); void setClassEnabled(int index, boolean b); void setClassFilter(int index, Filter filter); void setClassMaxScale(int index, Double maxValue); void setClassMinMaxScales(int index, Double minValue, Double maxValue); void setClassMinScale(int index, Double minValue); void setRuleNames(List<String> ruleNames); @Deprecated void setSelIdx(int selIdx); void setSymbolizers(List<TextSymbolizer> symbolizers); static final String DEFAULT_CLASS_RULENAME; static final Filter DEFAULT_FILTER_ALL_OTHERS; static final PropertyIsEqualTo oldClassesDisabledFilter; static final PropertyIsEqualTo oldClassesEnabledFilter; }### Answer:
@Test public void testExistsClass() throws IOException, CQLException { TextRuleList trl = new TextRuleList( TestDatasetsVector.arabicInHeader.getStyledFS(), false); trl.setEnabled(true); trl.addDefaultClass(); trl.addDefaultClass("de"); trl.addClass(StylingUtil.STYLE_BUILDER.createTextSymbolizer(), "testRuleName_DE", ECQL.toFilter("SURFACE>2000"), true, "de", null, null); assertFalse(trl.existsClass(ECQL.toFilter("1=5"), "de")); assertFalse(trl.existsClass(ECQL.toFilter("1=5"), null)); assertFalse(trl.existsClass(ECQL.toFilter("1=5"), null)); assertFalse(trl.existsClass(ECQL.toFilter("SURFACE>2000"), null)); assertTrue(trl.existsClass(ECQL.toFilter("SURFACE>2000"), "de")); assertTrue(trl .existsClass(TextRuleList.DEFAULT_FILTER_ALL_OTHERS, null)); }