@Test
public void testScanWithPreInstallUrl() throws Exception {

    final File testPackage = TestPackageUtil.prepareTestPackage("tmp_foo_bar.zip");
    final InitStage stage = new InitStage.Builder().withNs("foo", "http://foo.com").build();
    final CompletableFuture<Boolean> fooUrlLatch = new CompletableFuture<>();
    final ProgressCheck check = mock(ProgressCheck.class);
    doAnswer(call -> {
        fooUrlLatch.complete(call.getArgument(1, Session.class).nodeExists("/tmp/foo/bar"));
        return true;
    }).when(check)
            .beforeExtract(
                    any(PackageId.class),
                    any(Session.class),
                    any(PackageProperties.class),
                    any(MetaInf.class),
                    any(List.class)
            );
    builder().withInitStage(stage)
            .withPreInstallUrl(testPackage.toURI().toURL())
            .withProgressCheck(check)
            .build().scanPackage(testPackage);
    assertTrue("uri is same", fooUrlLatch.getNow(false));
}