Multithreading: when doing unit test, use thread pool to find that the specified code is not running and skip directly

Today, we did a unit test to debug the interface. We found that the interface call was successful, but we did not run the thread pool execution method. Instead, we directly skipped the execution code


 ExecutorService pool = Executors.newFixedThreadPool( 2 );


 public void callInterfaceCreditease(final String idcard,final String name,final String mobile){
            ExecutorService pool = Executors.newFixedThreadPool( 2 );
            pool.execute(new Runnable() {
                public void run() {
                    creditCardCrediteaseService.doFetchCreditData(name, idcard, mobile);
            //Release thread pool resources
        }catch(Exception e){
            log.error("Calling interface exceptions:",e);


Read More: