@Test void toDTOShouldConvertQueryWithSenderEquals() throws Exception { Query query = Query.of( CriterionFactory.hasSender(new MailAddress("user@james.org")) ); assertThat(queryTranslator.toDTO(query)).isEqualTo(QueryDTO.and( new CriterionDTO(FieldName.SENDER.getValue(), Operator.EQUALS.getValue(), "user@james.org") )); }
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);  }