@Test
public void testPickupFromIncompleteCopy() {

    Map<String, ResolverResult> dirLayerMappings;
    try (FDBRecordContext context = database.openContext()) {
        // seed with some initial values
        dirLayerMappings = seedDirectoryLayer(context, primary, 34);
    }
    ResolverMappingReplicator incompleteReplicator = new ResolverMappingReplicator(primary, 10);
    incompleteReplicator.copyTo(replica);
    try (FDBRecordContext context = database.openContext()) {
        List<CompletableFuture<Boolean>> existsFutures = new ArrayList<>();
        for (Map.Entry<String, ResolverResult> entry : dirLayerMappings.entrySet()) {
            existsFutures.add(replica.read(context, entry.getKey()).thenApply(Optional::isPresent));
        }
        List<Boolean> results = AsyncUtil.getAll(existsFutures).join();
        long presentValues = results.stream().filter(a -> a).count();
        assertThat(presentValues, is(34L));
    }
    Map<String, ResolverResult> newMappings;
    try (FDBRecordContext context = database.openContext()) {
        // add some more entries to the primary
        newMappings = seedDirectoryLayer(context, primary, 66);
    }
    Map<String, ResolverResult> totalMappings = ImmutableMap.<String, ResolverResult>builder()
            .putAll(dirLayerMappings)
            .putAll(newMappings)
            .build();
    ResolverMappingReplicator completeReplicator = new ResolverMappingReplicator(primary, 10);
    completeReplicator.copyTo(replica);
    assertContainsMappings(replica, totalMappings);
}