@Test public void shouldBeAbleToConvertCriteriaIntoACriteriaRepresentation() { Criteria criteria = Criteria.criteria().from(new Date()).to(new Date()).limit(10).page(1); CriteriaRepresentation representation = criteriaConversionService.convert(criteria); assertThat(representation.getPage()).isEqualTo(criteria.getPage()); assertThat(representation.getLimit()).isEqualTo(criteria.getLimit()); assertThat(representation.getFrom()).isNotNull(); assertThat(representation.getTo()).isNotNull(); }
public CriteriaRepresentation convert(Criteria criteria) { CriteriaRepresentation representation = new CriteriaRepresentation(); representation.setFrom(criteria.hasFrom() ? criteria.getFrom().getTime() : null); representation.setTo(criteria.hasTo() ? criteria.getTo().getTime() : null); representation.setPage(criteria.getPage()); representation.setLimit(criteria.getLimit()); return representation; }
CriteriaConversionService { public CriteriaRepresentation convert(Criteria criteria) { CriteriaRepresentation representation = new CriteriaRepresentation(); representation.setFrom(criteria.hasFrom() ? criteria.getFrom().getTime() : null); representation.setTo(criteria.hasTo() ? criteria.getTo().getTime() : null); representation.setPage(criteria.getPage()); representation.setLimit(criteria.getLimit()); return representation; } }
CriteriaConversionService { public CriteriaRepresentation convert(Criteria criteria) { CriteriaRepresentation representation = new CriteriaRepresentation(); representation.setFrom(criteria.hasFrom() ? criteria.getFrom().getTime() : null); representation.setTo(criteria.hasTo() ? criteria.getTo().getTime() : null); representation.setPage(criteria.getPage()); representation.setLimit(criteria.getLimit()); return representation; }  }
CriteriaConversionService { public CriteriaRepresentation convert(Criteria criteria) { CriteriaRepresentation representation = new CriteriaRepresentation(); representation.setFrom(criteria.hasFrom() ? criteria.getFrom().getTime() : null); representation.setTo(criteria.hasTo() ? criteria.getTo().getTime() : null); representation.setPage(criteria.getPage()); representation.setLimit(criteria.getLimit()); return representation; }  CriteriaRepresentation convert(Criteria criteria); }
CriteriaConversionService { public CriteriaRepresentation convert(Criteria criteria) { CriteriaRepresentation representation = new CriteriaRepresentation(); representation.setFrom(criteria.hasFrom() ? criteria.getFrom().getTime() : null); representation.setTo(criteria.hasTo() ? criteria.getTo().getTime() : null); representation.setPage(criteria.getPage()); representation.setLimit(criteria.getLimit()); return representation; }  CriteriaRepresentation convert(Criteria criteria);  }