use of com.orm.androrm.statement.LikeStatement in project androrm by androrm.
the class FilterTest method testContains.
public void testContains() {
Filter set = new Filter();
set.contains("supplier__name", "foo");
List<Rule> filters = set.getRules();
Rule filter = filters.get(0);
Statement s = filter.getStatement();
Set<String> keys = s.getKeys();
assertEquals("supplier__name", filter.getKey());
assertTrue(keys.contains("name"));
assertTrue(s instanceof LikeStatement);
assertEquals("name LIKE '%foo%'", s.toString());
}
use of com.orm.androrm.statement.LikeStatement in project androrm by androrm.
the class LikeStatementTest method testMatchBeginning.
public void testMatchBeginning() {
LikeStatement like = new LikeStatement("^foo", "bar");
assertEquals("foo LIKE 'bar%'", like.toString());
}
use of com.orm.androrm.statement.LikeStatement in project androrm by androrm.
the class LikeStatementTest method testPlainStatement.
public void testPlainStatement() {
LikeStatement like = new LikeStatement("foo", "bar");
assertEquals("foo LIKE '%bar%'", like.toString());
}
use of com.orm.androrm.statement.LikeStatement in project androrm by androrm.
the class LikeStatementTest method testGetKeys.
public void testGetKeys() {
LikeStatement like = new LikeStatement("foo", "bar");
Set<String> keys = like.getKeys();
assertEquals(1, keys.size());
assertTrue(keys.contains("foo"));
}
use of com.orm.androrm.statement.LikeStatement in project androrm by androrm.
the class OrStatementTest method testParanthesis.
public void testParanthesis() {
OrStatement left = new OrStatement(new Statement("foo", "bar"), new Statement("bar", "baz"));
OrStatement right = new OrStatement(new Statement("baz", "foo"), new LikeStatement("baz", "bar"));
AndStatement and = new AndStatement(left, right);
assertEquals("(foo = 'bar' OR bar = 'baz') AND (baz = 'foo' OR baz LIKE '%bar%')", and.toString());
}
Aggregations