// 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 @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(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()); }