@Test
public void testScanWithInitStage() 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<String> fooUrlLatch = new CompletableFuture<>();
    final ProgressCheck check = mock(ProgressCheck.class);
    doAnswer(call -> {
        fooUrlLatch.complete(call.getArgument(1, Session.class).getNamespaceURI("foo"));
        return true;
    }).when(check)
            .beforeExtract(
                    any(PackageId.class),
                    any(Session.class),
                    any(PackageProperties.class),
                    any(MetaInf.class),
                    any(List.class)
            );
    builder().withInitStage(stage).withProgressCheck(check).build().scanPackage(testPackage);
    assertEquals("uri is same", "http://foo.com", fooUrlLatch.getNow(""));
}