@DELETE
    @Timed
    @ApiOperation(value = "Delete all revisions of a content pack")
    @ApiResponses(value = {
            @ApiResponse(code = 400, message = "Missing or invalid content pack"),
            @ApiResponse(code = 500, message = "Error while saving content pack")
    })
    @AuditEvent(type = AuditEventTypes.CONTENT_PACK_DELETE)
    @Path("{contentPackId}")
    @JsonView(ContentPackView.HttpView.class)
    public void deleteContentPack(
            @ApiParam(name = "contentPackId", value = "Content Pack ID", required = true)
            @PathParam("contentPackId") final ModelId contentPackId) {
        checkPermission(RestPermissions.CONTENT_PACK_DELETE, contentPackId.toString());
        if (!contentPackInstallationPersistenceService.findByContentPackId(contentPackId).isEmpty()) {
            throw new BadRequestException("Content pack " + contentPackId +
                    " with all its revisions can't be deleted: There are still installations of this content pack");
        }
        final int deleted = contentPackPersistenceService.deleteById(contentPackId);

        LOG.debug("Deleted {} content packs with id {}", deleted, contentPackId);
    }
@Test
    public void notDeleteContentPack() throws Exception {
        final ModelId id = ModelId.of("1");
        when(contentPackInstallations.size()).thenReturn(1);
        when(contentPackInstallationPersistenceService.findByContentPackId(id)).thenReturn(contentPackInstallations);
        boolean exceptionCalled = false;
        try {
            contentPackResource.deleteContentPack(id);
        } catch (BadRequestException e) {
            exceptionCalled = true;
        }
        assertThat(exceptionCalled).isEqualTo(true);
        verify(contentPackInstallationPersistenceService, times(1)).findByContentPackId(id);
        verify(contentPackPersistenceService, times(0)).deleteById(id);

        when(contentPackInstallations.size()).thenReturn(1);
        when(contentPackInstallationPersistenceService.findByContentPackIdAndRevision(id, 1)).thenReturn(contentPackInstallations);
        exceptionCalled = false;
        try {
            contentPackResource.deleteContentPack(id, 1);
        } catch (BadRequestException e) {
            exceptionCalled = true;
        }
        assertThat(exceptionCalled).isEqualTo(true);
        verify(contentPackInstallationPersistenceService, times(1)).findByContentPackIdAndRevision(id, 1);
        verify(contentPackPersistenceService, times(0)).deleteByIdAndRevision(id, 1);
    }