@Test
public void testTokens_matchesRegexp() throws InvalidQueryException {

  List<Token> listTokens = new ArrayList<Token>();
  listTokens.add(new Token(Token.TYPE.BRACKET_OPEN, "("));
  listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".matches("));
  listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "StackConfigurations/property_type"));
  listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "(([^=])|=|!=),.in(&).*USER.*.isEmpty(a).matches(b)"));
  listTokens.add(new Token(Token.TYPE.BRACKET_CLOSE, ")"));
  listTokens.add(new Token(Token.TYPE.LOGICAL_OPERATOR, "|"));
  listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".matches("));
  listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "StackConfigurations/property_type"));
  listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "fields format to from .*GROUP.*"));
  listTokens.add(new Token(Token.TYPE.BRACKET_CLOSE, ")"));
  listTokens.add(new Token(Token.TYPE.BRACKET_CLOSE, ")"));
  QueryLexer lexer = new QueryLexer();
  Token[] tokens = lexer.tokens("(StackConfigurations/property_type.matches((([^=])|=|!=),.in(&).*USER.*" +
      ".isEmpty(a).matches(b))|StackConfigurations/property_type.matches(fields format to from .*GROUP.*))");
  assertArrayEquals("All characters between \".matches(\" and corresponding closing \")\" bracket should " +
      "come to VALUE_OPERAND.", listTokens.toArray(new Token[listTokens.size()]), tokens);
}