如何为使用线程的方法编写单元测试。
在下面的示例中如何测试 someMethod 方法?
public class SomeClass {
private final SomeOtherClass someOtherClassInstance = IoC.getInstance(SomeOtherClass.class);
private final ExecutorService executorService = Executors.newCachedThreadPool();
public void someMethod() {
executorService.execute(new Runnable() {
@Override
public void run() {
someOtherClassInstance.someOtherMethod();
}
});
}
}
java和.net中有没有为此目的的解决方案?