use of com.cinchapi.ccl.grammar.KeySymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testToPostfixNotationSimpleBetween.
@Test
public void testToPostfixNotationSimpleBetween() {
Criteria criteria = Criteria.where().key("foo").operator(Operator.BETWEEN).value("bar").value("baz").build();
Queue<PostfixNotationSymbol> pfn = Parsing.toPostfixNotation(criteria.symbols());
Assert.assertEquals(pfn.size(), 1);
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).key(), new KeySymbol("foo"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).values().get(0), new ValueSymbol("bar"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).values().get(1), new ValueSymbol("baz"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).operator(), new OperatorSymbol(Operator.BETWEEN));
}
use of com.cinchapi.ccl.grammar.KeySymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testToPostfixNotationSimple.
@Test
public void testToPostfixNotationSimple() {
Criteria criteria = Criteria.where().key("foo").operator(Operator.EQUALS).value("bar").build();
Queue<PostfixNotationSymbol> pfn = Parsing.toPostfixNotation(criteria.symbols());
Assert.assertEquals(pfn.size(), 1);
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).key(), new KeySymbol("foo"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).values().get(0), new ValueSymbol("bar"));
Assert.assertEquals(((ExpressionSymbol) Iterables.getOnlyElement(pfn)).operator(), new OperatorSymbol(Operator.EQUALS));
}
use of com.cinchapi.ccl.grammar.KeySymbol in project concourse by cinchapi.
the class ConcourseCompilerTest method testGroupSyntaxException.
@Test(expected = SyntaxException.class)
public void testGroupSyntaxException() {
List<Symbol> symbols = Lists.<Symbol>newArrayList(new KeySymbol("foo"), new KeySymbol("bar"));
Parsing.groupExpressions(symbols);
}
use of com.cinchapi.ccl.grammar.KeySymbol in project concourse by cinchapi.
the class CriteriaTest method testCannotAddSymbolToBuiltCriteria.
@Test(expected = IllegalStateException.class)
public void testCannotAddSymbolToBuiltCriteria() {
Criteria criteria = Criteria.where().key("foo").operator(Operator.EQUALS).value("bar").build();
((BuiltCriteria) criteria).add(new KeySymbol("baz"));
}
Aggregations