@Test
public void testBuildAndScanWithInstallHookPolicyReport() throws Exception {

    final File testPackage = TestPackageUtil.prepareTestPackage("tmp_foo_bar.zip");
    final InstallHookProcessor processor = mock(InstallHookProcessor.class);
    when(processor.execute(any(InstallContext.class))).thenReturn(true);
    doThrow(PackageException.class).when(processor)
            .registerHooks(any(Archive.class), any(ClassLoader.class));
    final Collection<CheckReport> reports = builder()
            .withInstallHookProcessorFactory(() -> processor)
            .withInstallHookPolicy(InstallHookPolicy.REPORT)
            .build().scanPackage(testPackage);
    assertTrue("reports has one report with one violation",
            reports.stream().anyMatch(report -> report.getViolations().size() == 1));
}