@Test(expected = AbortedScanException.class)
public void testBuildAndScanWithInstallHookPolicyAbort() throws Exception {

    final File testPackage = TestPackageUtil.prepareTestPackage("tmp_foo_bar.zip");
    final InstallHookProcessor processor = mock(InstallHookProcessor.class);
    doThrow(new PackageException("abort")).when(processor)
            .registerHooks(any(Archive.class), any(ClassLoader.class));
    builder().withInstallHookProcessorFactory(() -> processor)
            .withInstallHookPolicy(InstallHookPolicy.ABORT)
            .build().scanPackage(testPackage);
}