PropertyFilter extends AbstractStringBasedFilter { @Override public boolean accept(LogData logData, int row) { if (mode.equals(Mode.AllProperties) && StringUtils.isBlank(condition)) { return true; } final Map<String, String> properties = logData.getProperties(); if (mode.equals(Mode.AllProperties)) { Collection<String> values = properties.values(); for (String string : values) { if (contains(string, condition, isIgnoreCase())) { return true; } } } else if (mode.equals(Mode.SinglePropertyEquals)) { if (value.length() == 0) { return properties.containsKey(property); } else { String propValue = properties.getOrDefault(property, ""); if (isIgnoreCase()) { return StringUtils.equalsIgnoreCase(propValue, value); } else { return StringUtils.equals(propValue, value); } } } else if (mode.equals(Mode.SinglePropertyLike)) { String propValue = properties.get(property); return contains(propValue, value, ignoreCase); } return false; } PropertyFilter(); @Override boolean accept(LogData logData, int row); void setCondition(String key, String value);  }
@Test(dataProvider = "testAcceptDataProvider") public void testAccept(LogData logData, String text, Case caseSensitive, boolean expected) { final PropertyFilter propertyFilter = new PropertyFilter(); propertyFilter.setIgnoreCase(caseSensitive.equals(Case.CaseIgnore)); propertyFilter.setFilteringText(text); propertyFilter.performPreFiltering(); final boolean actual = propertyFilter.accept(logData, 0); assertEquals(expected, actual); }