@GET
    @Path("{id}/stats")
    @Timed
    @ApiOperation(value = "Get index set statistics")
    @ApiResponses(value = {
            @ApiResponse(code = 403, message = "Unauthorized"),
            @ApiResponse(code = 404, message = "Index set not found"),
    })
    public IndexSetStats indexSetStatistics(@ApiParam(name = "id", required = true)
                                            @PathParam("id") String id) {
        checkPermission(RestPermissions.INDEXSETS_READ, id);
        return indexSetRegistry.get(id)
                .map(indexSetStatsCreator::getForIndexSet)
                .orElseThrow(() -> new NotFoundException("Couldn't load index set with ID <" + id + ">"));
    }
@Test
    public void indexSetStatistics() {
        final IndexSet indexSet = mock(IndexSet.class);
        final IndexSetStats indexSetStats = IndexSetStats.create(5L, 23L, 42L);

        when(indexSetRegistry.get("id")).thenReturn(Optional.of(indexSet));
        when(indexSetStatsCreator.getForIndexSet(indexSet)).thenReturn(indexSetStats);

        assertThat(indexSetsResource.indexSetStatistics("id")).isEqualTo(indexSetStats);
    }