PagedRequestConverter extends AbstractConverter<PagedRequest<?>, MultiplePagedSearch<T>> { @Override public MultiplePagedSearch<T> convert(final PagedRequest<?> source, final MultiplePagedSearch<T> target) { target.setOffset(source.getOffset()); target.setLimit(source.getLimit()); target.setOrders(source.getOrders()); return target; }  @Override MultiplePagedSearch<T> convert(final PagedRequest<?> source, final MultiplePagedSearch<T> target); @Override MultiplePagedSearch<T> convert(final PagedRequest<?> source);  }
@Test public void testConvert() throws Exception { Integer limit = 20; Integer offset = 0; OrderBy order1 = new OrderBy(); order1.setFieldName("description"); order1.setType(OrderByType.ASC); OrderBy order2 = new OrderBy(); order2.setFieldName("name"); order2.setType(OrderByType.DESC); List<OrderBy> orders = Arrays.asList(order1, order2); PagedRequest<Department> source = new PagedRequest<Department>(); source.setLimit(limit); source.setOffset(offset); source.setOrders(orders); MultiplePagedSearch<Department> expected = new MultiplePagedSearch<Department>(); expected.setLimit(limit); expected.setOffset(offset); expected.setOrders(orders); MultiplePagedSearch<Department> actual = unit.convert(source); assertEquals(expected, actual); }