AssetQueryParameters { public PaginationOptions getPagination() throws InvalidParameterException { String limitString = params.get(LIMIT_PARAM); String offsetString = params.get(OFFSET_PARAM); if (limitString == null && offsetString == null) { return null; } if (limitString == null || offsetString == null) { throw new InvalidParameterException("If either " + LIMIT_PARAM + " or " + OFFSET_PARAM + " is provided then both must be provided"); } int limit; int offset; try { limit = Integer.parseInt(limitString); } catch (NumberFormatException e) { throw new InvalidParameterException(LIMIT_PARAM + " must be an integer"); } try { offset = Integer.parseInt(offsetString); } catch (NumberFormatException e) { throw new InvalidParameterException(OFFSET_PARAM + " must be an integer"); } return new PaginationOptions(offset, limit); } private  AssetQueryParameters(Map<String, String> params); static AssetQueryParameters create(UriInfo uriInfo); Collection<AssetFilter> getFilters(); PaginationOptions getPagination(); String getSearchTerm(); String getFields(); SortOptions getSortOptions();  }
@Test public void testGetPagination() throws Exception { UriInfo uriInfo = new DummyUriInfo("http: AssetQueryParameters params = AssetQueryParameters.create(uriInfo); assertEquals(new PaginationOptions(5, 2), params.getPagination()); params = AssetQueryParameters.create(ALL_PARAMS_URI); assertEquals(new PaginationOptions(100, 12), params.getPagination()); }