### Question:
TLDEventDataFilter extends EventDataQueryExpressionFilter { @Override public boolean apply(Entry<Key,String> input) { return apply(input, true); } TLDEventDataFilter(ASTJexlScript script, TypeMetadata attributeFactory, Set<String> whitelist, Set<String> blacklist, long maxFieldsBeforeSeek,
                    long maxKeysBeforeSeek);  TLDEventDataFilter(ASTJexlScript script, TypeMetadata attributeFactory, Set<String> whitelist, Set<String> blacklist, long maxFieldsBeforeSeek,
                    long maxKeysBeforeSeek, Map<String,Integer> limitFieldsMap, String limitFieldsField, Set<String> nonEventFields);  TLDEventDataFilter(TLDEventDataFilter other); @Override void startNewDocument(Key document); @Override boolean apply(Entry<Key,String> input); @Override boolean peek(Entry<Key,String> input); @Override Key getStopKey(Key from); @Override boolean keep(Key k); static boolean isRootPointer(Key k); @Override Range getSeekRange(Key current, Key endKey, boolean endKeyInclusive); @Override Key transform(Key toLimit); @Override EventDataQueryFilter clone(); static final byte[] FI_CF; static final byte[] TF_CF; }### Answer:
@Test public void apply_acceptSuperRejectTest() throws ParseException { ASTJexlScript query = JexlASTHelper.parseJexlQuery("FOO == 'bar'"); expect(mockAttributeFactory.getTypeMetadata("FOO", "datatype")).andReturn(Collections.emptyList()); replayAll(); filter = new TLDEventDataFilter(query, mockAttributeFactory, null, null, -1, 01); Key key1 = new Key("row", "datatype" + Constants.NULL + "123.234.345", "FOO" + Constants.NULL_BYTE_STRING + "baz"); Key key2 = new Key("row", "datatype" + Constants.NULL + "123.234.345.11", "FOO" + Constants.NULL_BYTE_STRING + "baz"); boolean tldResult = filter.apply(new AbstractMap.SimpleEntry<>(key1, null)); boolean result = filter.apply(new AbstractMap.SimpleEntry<>(key2, null)); verifyAll(); assertTrue(tldResult); assertFalse(result); }
@Test public void apply_acceptGroupingFields() throws ParseException { ASTJexlScript query = JexlASTHelper.parseJexlQuery("grouping:matchesInGroup(FOO, 'bar')"); expect(mockAttributeFactory.getTypeMetadata("FOO", "datatype")).andReturn(Collections.emptyList()).anyTimes(); replayAll(); filter = new TLDEventDataFilter(query, mockAttributeFactory, null, null, -1, -1); Key key1 = new Key("row", "datatype" + Constants.NULL + "123.234.345", "FOO" + Constants.NULL_BYTE_STRING + "baz"); Key key2 = new Key("row", "datatype" + Constants.NULL + "123.234.345.11", "FOO" + Constants.NULL_BYTE_STRING + "baz"); Key key3 = new Key("row", "datatype" + Constants.NULL + "123.234.345.11", "FOOT" + Constants.NULL_BYTE_STRING + "bar"); Key key4 = new Key("row", "datatype" + Constants.NULL + "123.234.345.11", "FOO" + Constants.NULL_BYTE_STRING + "bar"); boolean result1 = filter.apply(new AbstractMap.SimpleEntry<>(key1, null)); boolean result2 = filter.apply(new AbstractMap.SimpleEntry<>(key2, null)); boolean result3 = filter.apply(new AbstractMap.SimpleEntry<>(key3, null)); boolean result4 = filter.apply(new AbstractMap.SimpleEntry<>(key4, null)); verifyAll(); assertTrue(result1); assertFalse(result2); assertFalse(result3); assertTrue(result4); }