@Test
void testAllocationsParallelSameTransaction() {

    final Map<Long, String> allocated;
    try (FDBRecordContext context = database.openContext()) {
        HighContentionAllocator hca = new HighContentionAllocator(context, keySpace.path("test-path"));
        List<CompletableFuture<Pair<Long, String>>> allocationOperations = new ArrayList<>();
        for (int i = 0; i < 50; i++) {
            String storedValue = "allocate-" + i;
            allocationOperations.add(hca.allocate(storedValue).thenApply(id -> Pair.of(id, storedValue)));
        }
        allocated = AsyncUtil.getAll(allocationOperations).join().stream()
                .collect(Collectors.toMap(Pair::getLeft, Pair::getRight));
        assertThat("every allocation operation has a distinct value", allocated.entrySet(), hasSize(50));
        validateAllocation(context, hca, allocated);
        context.commit();
    }
}