@Test
void testAllocationsParallelSeparateTransactions() {

    List<CompletableFuture<Pair<Long, String>>> allocationOperations = new ArrayList<>();
    AtomicInteger count = new AtomicInteger();
    for (int i = 0; i < 50; i++) {
        CompletableFuture<Pair<Long, String>> allocation = database.runAsync(context -> {
            HighContentionAllocator hca = new HighContentionAllocator(context, keySpace.path("test-path"));
            String storedValue = "allocate-" + count.getAndIncrement();
            return hca.allocate(storedValue).thenApply(id -> Pair.of(id, storedValue));
        });
        allocationOperations.add(allocation);
    }
    Map<Long, String> allocated = AsyncUtil.getAll(allocationOperations).join().stream()
            .collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
    assertThat("all values are allocated", allocated.entrySet(), hasSize(50));
    try (FDBRecordContext context = database.openContext()) {
        HighContentionAllocator hca = new HighContentionAllocator(context, keySpace.path("test-path"));
        validateAllocation(context, hca, allocated);
    }
}