StringIsPrefixOf extends SimpleQuery<O, A> { @Override protected boolean matchesSimpleAttribute(SimpleAttribute<O, A> attribute, O object, QueryOptions queryOptions) { CharSequence attributeValue = attribute.getValue(object, queryOptions); return StringStartsWith.matchesValue(value, attributeValue, queryOptions); } StringIsPrefixOf(Attribute<O, A> attribute, A value); A getValue(); @Override int calcHashCode(); @Override boolean equals(Object o);  }
@Test public void testMatchesSimpleAttribute() throws Exception { assertTrue(isPrefixOf(stringIdentity, "FOO").matches("F", noQueryOptions())); assertTrue(isPrefixOf(stringIdentity, "FOO").matches("FO", noQueryOptions())); assertTrue(isPrefixOf(stringIdentity, "FOO").matches("FOO", noQueryOptions())); assertFalse(isPrefixOf(stringIdentity, "FOO").matches("OO", noQueryOptions())); assertFalse(isPrefixOf(stringIdentity, "FOO").matches("BOO", noQueryOptions())); assertFalse(isPrefixOf(stringIdentity, "FOO").matches("FOOOD", noQueryOptions())); }