### Question:
ResponseBuilder { public static <T> Response<T> buildResponse(final HttpServletRequest request, final int offset, final int limit, final long total, final List<T> elements) { checkArgument(offset >= 0); checkArgument(limit >= 1); checkArgument(total >= 0); checkArgument(total == 0 || offset < total); String requestUri = request.getRequestURI(); String queryString = request.getQueryString(); String href = requestUri + (!Strings.isNullOrEmpty(queryString) ? "?" + queryString : ""); NavigationItem previous = new NavigationItem(hasPreviousPage(offset) ? requestUri + String.format(QUERY_STRING_FORMAT, getPreviousPageOffset(offset, limit), limit) : ""); NavigationItem next = new NavigationItem(hasNextPage(offset, limit, total) ? requestUri + String.format(QUERY_STRING_FORMAT, getNextPageOffset(offset, limit, total), limit) : ""); NavigationItem first = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getFirstPageOffset(), limit)); NavigationItem last = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getLastPageOffset(total, limit), limit)); return new Response<>(href, previous, next, first, last, elements); } private  ResponseBuilder(); static Response<T> buildResponse(final HttpServletRequest request, final int offset, final int limit, final long total, final List<T> elements);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testResponseBuilderInvalidOffset() { ResponseBuilder.buildResponse(request, -1, 1, 0, Lists.<String>newArrayList()); }
@Test(expected = IllegalArgumentException.class) public void testResponseBuilderInvalidLimit() { ResponseBuilder.buildResponse(request, 0, 0, 1, Lists.<String>newArrayList()); }
@Test(expected = IllegalArgumentException.class) public void testResponseBuilderInvalidTotal() { ResponseBuilder.buildResponse(request, 0, 1, -1, Lists.<String>newArrayList()); }
@Test(expected = IllegalArgumentException.class) public void testResponseBuilderOffsetEqualToTotalWhenTotalGreaterThanZero() { ResponseBuilder.buildResponse(request, 1, 1, 1, Lists.<String>newArrayList()); }