### Question:
GetResponseBuilder extends ResponseBuilder { protected void validatePublicResourceQuery(final UriInfo uriInfo) { List<PathSegment> uriPathSegments = uriInfo.getPathSegments(); if (uriPathSegments != null) { if (uriPathSegments.size() == 2) { String endpoint = uriPathSegments.get(1).getPath(); if (this.resourceEndPoint.getQueryingDisallowedEndPoints().contains(endpoint)) { ApiQuery apiQuery = new ApiQuery(uriInfo); if (apiQuery.getCriteria().size() > 0) { throw new QueryParseException("Querying not allowed", apiQuery.toString()); } } } } }  Response build(final UriInfo uriInfo, final ResourceTemplate template,
                          final ResourceMethod method, final GenericResource.GetResourceLogic logic); static final String ORIGINAL_REQUEST_KEY; }### Answer:
@Ignore @Test(expected = QueryParseException.class) public void testValidatePublicResourceInvalidQuery() throws URISyntaxException { requestURI = new URI(URI + "?someField=someValue"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); }
@Ignore @Test(expected = QueryParseException.class) public void testValidatePublicResourceMultiInvalidQuery() throws URISyntaxException { requestURI = new URI(URI + "?limit=0&someField=someValue&includeFields=somefield"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); }
@Test public void testValidatePublicResourceQueryValidQuery() throws URISyntaxException { try { requestURI = new URI(URI + "?limit=0"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception"); } }
@Test public void testValidatePublicResourceQueryMultiValidQuery() throws URISyntaxException { try { requestURI = new URI(URI + "?limit=0&includeFields=somefield"); setupMocks("assessments"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception"); } }
@Test public void testValidateNonPublicResourceFilter() throws URISyntaxException { try { requestURI = new URI(URI + "?someField=someValue"); setupMocks("students"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception"); } }
@Test public void testValidateNonPublicResource() throws URISyntaxException { try { requestURI = new URI(URI + "?limit=0"); setupMocks("students"); getResponseBuilder.validatePublicResourceQuery(uriInfo); } catch (QueryParseException e) { fail("Should not throw an exception"); } }