@Test void fromShouldReturnMatchAllWhenEmptyClauses() { QuotaQuery query = QuotaQuery.builder().build(); QueryBuilder expected = matchAllQuery(); QueryBuilder actual = testee.from(query); assertThat(actual).isEqualToComparingFieldByField(expected); }
QueryBuilder from(QuotaQuery query) { List<QuotaClause> clauses = query.getClause().getClauses(); if (clauses.isEmpty()) { return matchAllQuery(); } if (clauses.size() == 1) { return singleClauseAsESQuery(clauses.get(0)); } return clausesAsAndESQuery(clauses); }
QuotaQueryConverter { QueryBuilder from(QuotaQuery query) { List<QuotaClause> clauses = query.getClause().getClauses(); if (clauses.isEmpty()) { return matchAllQuery(); } if (clauses.size() == 1) { return singleClauseAsESQuery(clauses.get(0)); } return clausesAsAndESQuery(clauses); } }
QuotaQueryConverter { QueryBuilder from(QuotaQuery query) { List<QuotaClause> clauses = query.getClause().getClauses(); if (clauses.isEmpty()) { return matchAllQuery(); } if (clauses.size() == 1) { return singleClauseAsESQuery(clauses.get(0)); } return clausesAsAndESQuery(clauses); } QuotaQueryConverter(); }
QuotaQueryConverter { QueryBuilder from(QuotaQuery query) { List<QuotaClause> clauses = query.getClause().getClauses(); if (clauses.isEmpty()) { return matchAllQuery(); } if (clauses.size() == 1) { return singleClauseAsESQuery(clauses.get(0)); } return clausesAsAndESQuery(clauses); } QuotaQueryConverter();  }
QuotaQueryConverter { QueryBuilder from(QuotaQuery query) { List<QuotaClause> clauses = query.getClause().getClauses(); if (clauses.isEmpty()) { return matchAllQuery(); } if (clauses.size() == 1) { return singleClauseAsESQuery(clauses.get(0)); } return clausesAsAndESQuery(clauses); } QuotaQueryConverter();   }