@Test
public void testScanWithSubpackages() throws Exception {

    final File testPackage = TestPackageUtil.prepareTestPackage("subsubtest.zip");
    final Map<PackageId, PackageId> expectIds = new LinkedHashMap<>();
    final PackageId root = PackageId.fromString("my_packages:subsubtest");
    final PackageId sub1 = PackageId.fromString("my_packages:subtest");
    final PackageId suba = PackageId.fromString("my_packages:sub_a");
    final PackageId subb = PackageId.fromString("my_packages:sub_b");
    expectIds.put(sub1, root);
    expectIds.put(suba, sub1);
    expectIds.put(subb, sub1);
    final Map<PackageId, PackageId> subToParent = new LinkedHashMap<>();
    final ProgressCheck check = mock(ProgressCheck.class);
    doAnswer(call -> subToParent.put(call.getArgument(0), call.getArgument(1)))
            .when(check).identifySubpackage(any(PackageId.class), any(PackageId.class));
    builder().withProgressCheck(check).build().scanPackage(testPackage);
    assertEquals("expect ids", expectIds, subToParent);
}