@Test
public void testParse_mismatchedBrackets() {

  List<Token> listTokens = new ArrayList<Token>();
  // a=1&(b<=2|c>3
  listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
  listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "a"));
  listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
  listTokens.add(new Token(Token.TYPE.LOGICAL_OPERATOR, "&"));
  listTokens.add(new Token(Token.TYPE.BRACKET_OPEN, "("));
  listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "<="));
  listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "b"));
  listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "2"));
  listTokens.add(new Token(Token.TYPE.LOGICAL_OPERATOR, "|"));
  listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, ">"));
  listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "c"));
  listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "3"));
  try {
    new QueryParser().parse(listTokens.toArray(new Token[listTokens.size()]));
    fail("Expected InvalidQueryException due to missing closing bracket");
  } catch (InvalidQueryException e) {
    // expected
  }
}