@Test(timeout = 200000)
  public void testMtt() {
    final int baseAllocSizeLog2 = 3, maxAllocSizeLog2 = 10, totalSize = 8192,
        baseAllocSize = 1 << baseAllocSizeLog2, maxAllocSize = 1 << maxAllocSizeLog2;
    final int threadCount = maxAllocSizeLog2 - baseAllocSizeLog2 + 1;
    final int iterCount = 500;
    final BuddyAllocator a = create(maxAllocSize, 4, totalSize, true, false);
    ExecutorService executor = Executors.newFixedThreadPool(threadCount + 1);
    CountDownLatch cdlIn = new CountDownLatch(threadCount), cdlOut = new CountDownLatch(1);
    @SuppressWarnings("unchecked")
    FutureTask<MttTestCallableResult>[] allocTasks = new FutureTask[threadCount];
    FutureTask<Void> dumpTask = createAllocatorDumpTask(a);
    for (int allocSize = baseAllocSize, i = 0; allocSize <= maxAllocSize; allocSize <<= 1, ++i) {
      allocTasks[i] = new FutureTask<>(new MttTestCallable(
          cdlIn, cdlOut, a, allocSize, totalSize / allocSize, iterCount));
      executor.execute(allocTasks[i]);
    }
    executor.execute(dumpTask);

    runMttTest(a, allocTasks, cdlIn, cdlOut, dumpTask, null, null, totalSize, maxAllocSize);
  }
This relies on allocations basically being sequential, no internal reordering. Rather,
the specific paths it takes do; all the scenarios should work regardless of allocation.
llap-server/src/test/org/apache/hadoop/hive/llap/cache/TestBuddyAllocatorForceEvict.java