@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<String>();
  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);
  // since the request didn't have paging, then this should be false
  assertFalse(response.isPagedResponse());
  // add a paged request
  PageRequest pageRequest = new PageRequestImpl(StartingPoint.Beginning, 5, 10, predicate, null);
  request = PropertyHelper.getReadRequest(requestProperties, null, null, pageRequest, null);
  response = provider.queryForResources(request, predicate);
  // now the request has paging
  assertTrue(response.isPagedResponse());
  verify(m_dao);
}