@Test
  @Category(IntegrationTest.class)
  public void testWpsPostXml() throws Exception {
    ReviewTestUtils.createDataToPrepare();

    final String response = testWps(false, false, String.valueOf(mapId));
    final String jobId = verifyWpsResponse(response);
    (new JobStatusWebPoller(resource(), conn)).pollJobStatusUntilCompleteOrFail(jobId, false);
    ReviewTestUtils.jobId = jobId;
    ReviewTestUtils.verifyDataPrepared(mapId);
  }
  @Test
  @Category(UnitTest.class)
  public void testGetWithScoreMin() throws Exception {
    ReviewTestUtils.createPreparedData(resource());
    ReviewTestUtils.markSomeItemsReviewed();

    final ReviewableItemsStatistics response = execGet(String.valueOf(mapId), "0.928", null);

    Assert.assertEquals(mapId, response.getMapId());
    Assert.assertEquals(54, response.getNumTotalItems());
    Assert.assertEquals(5, response.getNumReviewableItems());
    Assert.assertEquals(3, response.getNumReviewedItems());
  }
  @Test
  @Category(IntegrationTest.class)
  public void testWpsError() throws Exception {
    ReviewTestUtils.createDataToPrepare();

    final String response = testWps(true, true, String.valueOf(mapId + 2));
    verifyWpsErrorResponse(response, Status.NOT_FOUND, "No record exists");
  }
  @Test
  @Category(UnitTest.class)
  public void testGetByBounds() throws Exception {
    final BoundingBox queryBounds = ReviewTestUtils.createTestQueryBounds();
    ReviewTestUtils.createPreparedData(resource());
    ReviewTestUtils.markSomeItemsReviewed();

    final ReviewableItemsStatistics response =
        execGet(String.valueOf(mapId), null, queryBounds.toServicesString());

    Assert.assertEquals(mapId, response.getMapId());
    Assert.assertEquals(54, response.getNumTotalItems());
    // TODO: fix - this should be returning 7 instead; I believe its ignoring way -44, whose review
    // against item is a relation with a node inside the query bounds; oddly enough the review get
    // resource test performs this query correctly, and they use nearly the same query code
    Assert.assertEquals(6, response.getNumReviewableItems());
    Assert.assertEquals(3, response.getNumReviewedItems());
  }
  // This behavior differs between Jersey and WPS.  Jersey will  automatically insert the default
  // value for empty numeric and boolean params.  This would be a 400 with WPS.
  // TODO: unify the behavior of the two tests??
  @Test
  @Category(UnitTest.class)
  public void testGetEmptyReviewScoreMinParam() throws Exception {
    ReviewTestUtils.createPreparedData(resource());

    // effectively, reviewScoreMinThreshold = 0.0
    final ReviewableItemsStatistics response = execGet(String.valueOf(mapId), "", null);

    Assert.assertEquals(mapId, response.getMapId());
    Assert.assertEquals(54, response.getNumTotalItems());
    Assert.assertEquals(16, response.getNumReviewableItems());
    Assert.assertEquals(0, response.getNumReviewedItems());
  }
  @Test(expected = UniformInterfaceException.class)
  @Category(UnitTest.class)
  public void testGetDataNotPrepared() throws Exception {
    ReviewTestUtils.createDataToPrepare();

    try {
      execGet(String.valueOf(mapId), null, null);
    } catch (UniformInterfaceException e) {
      int statcode1 = Status.PRECONDITION_FAILED.getStatusCode();
      int statcode2 = e.getResponse().getStatus();
      Assert.assertEquals(Status.PRECONDITION_FAILED.getStatusCode(), e.getResponse().getStatus());
      Assert.assertTrue(
          e.getResponse()
              .getEntity(String.class)
              .contains("The map with ID: " + mapId + " has not had review data prepared for it."));

      throw e;
    }
  }
  @Test
  @Category(UnitTest.class)
  public void testGetNoReviewableData() throws Exception {
    ReviewTestUtils.createDataToPrepare();

    // make a review map and job entry but don't write the reviewed data
    final String jobId = UUID.randomUUID().toString();
    DbUtils.insertJobStatus(jobId, JOB_STATUS.COMPLETE.toInt(), conn);
    ReviewMap mapReviewInfo = new ReviewMap();
    mapReviewInfo.setMapId(mapId);
    mapReviewInfo.setReviewPrepareJobId(jobId);
    QReviewMap reviewMap = QReviewMap.reviewMap;
    new SQLInsertClause(conn, DbUtils.getConfiguration(mapId), reviewMap)
        .populate(mapReviewInfo)
        .execute();

    final ReviewableItemsStatistics response = execGet(String.valueOf(mapId), null, null);

    Assert.assertEquals(mapId, response.getMapId());
    Assert.assertEquals(54, response.getNumTotalItems());
    Assert.assertEquals(0, response.getNumReviewableItems());
    Assert.assertEquals(0, response.getNumReviewedItems());
  }