CompletableFuture runAsync 中的单元测试代码

Lea*_*ner 6 java unit-testing asynchronous junit4 completable-future

有一个代码是由某人编写的,他调用了 Completable Future 来做一个调用并忘记的活动,即输出没有得到照顾(没有get()调用)。

CompletableFuture.runAsync(() -> {
            List<ActivityListTO> activities = auditCount(requestType, oldLimit, rule, newLimit);
            few mores lines here. 
...
, executor);
Run Code Online (Sandbox Code Playgroud)

我正在对此进行单元测试,但无法执行异步内部的代码。
我不能静态模拟它,因为我需要执行其中的代码。我尝试在我的测试用例中传递线程池实例,但它没有通过。

你能给我一些关于如何对异步中的代码进行单元测试的提示吗?