### Question:
Query { public Expression getExpression() { return expression; } Query();  Query(Expression expression); Query purge(); Expression getExpression(); void setExpression(Expression expression); int getSkip(); Query skip(int skip); int getLimit(); Query limit(int limit); SortingSpecification getSortingSpecification(); Query sort(String property, SortOption option); Query sort(SortingSpecification sortingSpecification); Query page(int number, int size);  }### Answer:
@Test void simpleSearch() { final var searchQuery = parse("hi my name is ryan"); assertThat(searchQuery.getExpression()) .asInstanceOf(type(SearchQuery.class)) .extracting(SearchQuery::getTerm) .isEqualTo("hi my name is ryan"); }
@Test void stringSearch() { var subject = "'ryan is my firstname and is not equals my last name or my middle name!!! @™@€'"; final var searchQuery = parse(subject); assertThat(searchQuery.getExpression()) .asInstanceOf(type(SearchQuery.class)) .extracting(SearchQuery::getTerm) .isEqualTo(subject.substring(1, subject.length() - 1)); }
@Test void orSearch() { final var searchQuery = parse("ryan or ryan"); assertThat(searchQuery.getExpression()) .asInstanceOf(type(BooleanGroup.class)) .satisfies(group -> { assertThat(group.getOperator()).isEqualTo(BooleanGroup.BooleanOperator.OR); assertThat(group.getExpressions()) .hasSize(2) .allSatisfy(expression -> assertThat(expression) .asInstanceOf(type(SearchQuery.class)) .extracting(SearchQuery::getTerm) .isEqualTo("ryan") ); }); }
@Test void andSearch() { final var searchQuery = parse("ryan AND ryan"); assertThat(searchQuery.getExpression()) .asInstanceOf(type(BooleanGroup.class)) .satisfies(group -> { assertThat(group.getOperator()).isEqualTo(BooleanGroup.BooleanOperator.AND); assertThat(group.getExpressions()) .hasSize(2) .allSatisfy(expression -> assertThat(expression) .asInstanceOf(type(SearchQuery.class)) .extracting(SearchQuery::getTerm) .isEqualTo("ryan") ); }); }