### Question:
AlertResourceProvider extends ReadOnlyResourceProvider implements
    ExtendedResourceProvider { @Override public QueryResponse queryForResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { return new QueryResponseImpl(getResources(request, predicate), request.getSortRequest() != null, request.getPageRequest() != null, alertsDAO.getCount(predicate)); } AlertResourceProvider(AmbariManagementController controller); @Override QueryResponse queryForResources(Request request, Predicate predicate); @Override Set<Resource> getResources(Request request, Predicate predicate); static final String ALERT_ID; static final String ALERT_STATE; static final String ALERT_ORIGINAL_TIMESTAMP; static final String ALERT_LATEST_TIMESTAMP; static final String ALERT_MAINTENANCE_STATE; static final String ALERT_DEFINITION_ID; static final String ALERT_DEFINITION_NAME; static final String ALERT_TEXT; static final String ALERT_CLUSTER_NAME; static final String ALERT_COMPONENT; static final String ALERT_HOST; static final String ALERT_SERVICE; }### Answer:
@Test public void testResponseIsPaginated() throws Exception { expect(m_dao.findAll(EasyMock.anyObject(AlertCurrentRequest.class))).andReturn( getClusterMockEntities()).atLeastOnce(); expect(m_dao.getCount(EasyMock.anyObject(Predicate.class))).andReturn(0).atLeastOnce(); replay(m_dao); SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator()); Set<String> requestProperties = new HashSet<>(); requestProperties.add(AlertResourceProvider.ALERT_ID); requestProperties.add(AlertResourceProvider.ALERT_DEFINITION_NAME); Request request = PropertyHelper.getReadRequest(requestProperties); Predicate predicate = new PredicateBuilder().property(AlertResourceProvider.ALERT_CLUSTER_NAME).equals( "c1").toPredicate(); AlertResourceProvider provider = createProvider(); QueryResponse response = provider.queryForResources(request, predicate); assertFalse(response.isPagedResponse()); PageRequest pageRequest = new PageRequestImpl(StartingPoint.Beginning, 5, 10, predicate, null); request = PropertyHelper.getReadRequest(requestProperties, null, null, pageRequest, null); response = provider.queryForResources(request, predicate); assertTrue(response.isPagedResponse()); verify(m_dao); }