@Test
public void testBuildAndScanWithInstallHookPolicyProhibit() throws Exception {

    final File testPackage = TestPackageUtil.prepareTestPackage("tmp_foo_bar.zip");
    final InstallHookProcessor processor = mock(InstallHookProcessor.class);
    when(processor.hasHooks()).thenReturn(true);
    doThrow(new PackageException("prohibit")).when(processor)
            .registerHooks(any(Archive.class), any(ClassLoader.class));
    final Collection<CheckReport> reports = builder()
            .withInstallHookProcessorFactory(() -> processor)
            .withInstallHookPolicy(InstallHookPolicy.PROHIBIT)
            .build().scanPackage(testPackage);
    assertTrue("reports has one report with two violations: " + reports.stream().findFirst(),
            reports.stream().anyMatch(report -> report.getViolations().size() == 2));
}