简体   繁体   中英

unit test case for void @Async method

I need to write unit test case for asynchronous method which doesn't return any value. Which is the best practice to test asynchronous method in spring boot and junit 5

You can write a normally test, ignoring the async and catching the possible exceptions.

For the test no matter if it's asynchronous, and yes if the code work as expected :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM