StringMatchesRegex extends SimpleQuery<O, A> { public StringMatchesRegex(Attribute<O, A> attribute, Pattern regexPattern) { super(attribute); this.regexPattern = checkQueryValueNotNull(regexPattern); } StringMatchesRegex(Attribute<O, A> attribute, Pattern regexPattern); @SuppressWarnings("unused") boolean matchesValue(A aValue, QueryOptions queryOptions); @Override boolean equals(Object o); @Override String toString();  }
@Test public void testStringMatchesRegex() { Query<String> query = matchesRegex(selfAttribute(String.class), "f.*"); IndexedCollection<String> indexedCollection = new ConcurrentIndexedCollection<String>(); indexedCollection.addAll(asList("foo1", "foo2", "bar", "baz", "car")); IndexedCollection<String> collection = indexedCollection; ResultSet<String> results = collection.retrieve(query); assertEquals(2, results.size()); assertTrue(results.iterator().hasNext()); }