@Test
public void testBuildWithInstallClassLoader() throws Exception {

    final File testPackage = TestPackageUtil.prepareTestPackage("tmp_foo_bar.zip");
    final ClassLoader hookClassLoader = new URLClassLoader(new URL[]{testPackage.toURI().toURL()}, null);
    final CompletableFuture<Boolean> latch = new CompletableFuture<>();
    final InstallHookProcessor processor = mock(InstallHookProcessor.class);
    when(processor.execute(any(InstallContext.class))).thenReturn(true);
    doAnswer(call -> latch.complete(hookClassLoader == call.getArgument(1, ClassLoader.class)))
            .when(processor)
            .registerHooks(any(Archive.class), any(ClassLoader.class));
    builder().withEnablePreInstallHooks(true)
            .withPreInstallUrl(testPackage.toURI().toURL())
            .withInstallHookProcessorFactory(() -> processor)
            .withInstallHookClassLoader(hookClassLoader)
            .build().initAndInspect(session -> {
        assertTrue("path should exist", session.nodeExists("/tmp/foo/bar"));
        assertTrue("hook processor was called with specific class loader", latch.getNow(false));
    });
}