@Test void testCreateQueryUnknownQueryOperatorException() { String rsqlQuery = "item=illegalOperator=value"; Exception exception = assertThrows(UnknownQueryOperatorException.class, () -> queryConverter.convert(rsqlQuery)); assertThat(exception.getMessage()).containsPattern("operator:=illegalOperator="); }
@Override public Query convert(@Nonnull String source) { Node node; try { node = rsqlParser.parse(source); } catch (RSQLParserException e) { Throwable cause = e.getCause(); if (cause instanceof UnknownOperatorException) { String operator = ((UnknownOperatorException) cause).getOperator(); throw new UnknownQueryOperatorException(operator); } else { throw new QueryParseException(e); } } return node.accept(rsqlVisitor); }
QueryConverter implements Converter<String, Query> { @Override public Query convert(@Nonnull String source) { Node node; try { node = rsqlParser.parse(source); } catch (RSQLParserException e) { Throwable cause = e.getCause(); if (cause instanceof UnknownOperatorException) { String operator = ((UnknownOperatorException) cause).getOperator(); throw new UnknownQueryOperatorException(operator); } else { throw new QueryParseException(e); } } return node.accept(rsqlVisitor); } }
QueryConverter implements Converter<String, Query> { @Override public Query convert(@Nonnull String source) { Node node; try { node = rsqlParser.parse(source); } catch (RSQLParserException e) { Throwable cause = e.getCause(); if (cause instanceof UnknownOperatorException) { String operator = ((UnknownOperatorException) cause).getOperator(); throw new UnknownQueryOperatorException(operator); } else { throw new QueryParseException(e); } } return node.accept(rsqlVisitor); } QueryConverter(RSQLParser rsqlParser, QueryRsqlVisitor rsqlVisitor); }
QueryConverter implements Converter<String, Query> { @Override public Query convert(@Nonnull String source) { Node node; try { node = rsqlParser.parse(source); } catch (RSQLParserException e) { Throwable cause = e.getCause(); if (cause instanceof UnknownOperatorException) { String operator = ((UnknownOperatorException) cause).getOperator(); throw new UnknownQueryOperatorException(operator); } else { throw new QueryParseException(e); } } return node.accept(rsqlVisitor); } QueryConverter(RSQLParser rsqlParser, QueryRsqlVisitor rsqlVisitor); @Override Query convert(@Nonnull String source); }
QueryConverter implements Converter<String, Query> { @Override public Query convert(@Nonnull String source) { Node node; try { node = rsqlParser.parse(source); } catch (RSQLParserException e) { Throwable cause = e.getCause(); if (cause instanceof UnknownOperatorException) { String operator = ((UnknownOperatorException) cause).getOperator(); throw new UnknownQueryOperatorException(operator); } else { throw new QueryParseException(e); } } return node.accept(rsqlVisitor); } QueryConverter(RSQLParser rsqlParser, QueryRsqlVisitor rsqlVisitor); @Override Query convert(@Nonnull String source);  }