@Test void toDTOShouldConvertQueryWithContainsOriginMailbox() { Query query = Query.of( CriterionFactory.containsOriginMailbox(TestId.of(1L)) ); assertThat(queryTranslator.toDTO(query)).isEqualTo(QueryDTO.and( new CriterionDTO(FieldName.ORIGIN_MAILBOXES.getValue(), Operator.CONTAINS.getValue(), "1") )); }
public QueryDTO toDTO(Query query) throws QueryTranslatorException { List<QueryElement> queryElements = query.getCriteria().stream() .map(this::toDTO) .collect(Guavate.toImmutableList()); return new QueryDTO(Combinator.AND.getValue(), queryElements); }
QueryTranslator { public QueryDTO toDTO(Query query) throws QueryTranslatorException { List<QueryElement> queryElements = query.getCriteria().stream() .map(this::toDTO) .collect(Guavate.toImmutableList()); return new QueryDTO(Combinator.AND.getValue(), queryElements); } }
QueryTranslator { public QueryDTO toDTO(Query query) throws QueryTranslatorException { List<QueryElement> queryElements = query.getCriteria().stream() .map(this::toDTO) .collect(Guavate.toImmutableList()); return new QueryDTO(Combinator.AND.getValue(), queryElements); } @Inject @VisibleForTesting  QueryTranslator(MailboxId.Factory mailboxIdFactory); }
QueryTranslator { public QueryDTO toDTO(Query query) throws QueryTranslatorException { List<QueryElement> queryElements = query.getCriteria().stream() .map(this::toDTO) .collect(Guavate.toImmutableList()); return new QueryDTO(Combinator.AND.getValue(), queryElements); } @Inject @VisibleForTesting  QueryTranslator(MailboxId.Factory mailboxIdFactory); static FieldName getField(String fieldNameString); Query translate(QueryElement queryElement); QueryDTO toDTO(Query query); }
QueryTranslator { public QueryDTO toDTO(Query query) throws QueryTranslatorException { List<QueryElement> queryElements = query.getCriteria().stream() .map(this::toDTO) .collect(Guavate.toImmutableList()); return new QueryDTO(Combinator.AND.getValue(), queryElements); } @Inject @VisibleForTesting  QueryTranslator(MailboxId.Factory mailboxIdFactory); static FieldName getField(String fieldNameString); Query translate(QueryElement queryElement); QueryDTO toDTO(Query query);  }