我想使用mockK库为以下功能编写单元测试:
gpg> expire
...enter the new expiration date...
gpg> save
我尝试使用嘲笑中提供的线程:
void function_name() {
new Thread(() -> {
try {
Thread.sleep(4000);
//some code
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
}
但是测试无法通过验证块提供。
如何测试包含延迟的上述功能。