join waits for the future to complete by waiting and get gives you the result of the future at the time of get method call. If the future is still in progress during the time of get call the you might get exception. Check docs on this.
So, waiting for the future to complete is one of the good ways during unit test unless you want to test out timeout functionality of the future. Also, there is a java library to test Futures as well, I'm not able to recollect it.
Vishwa Bhat
Technology Enthusiast
join waits for the future to complete by waiting and get gives you the result of the future at the time of get method call. If the future is still in progress during the time of get call the you might get exception. Check docs on this.
So, waiting for the future to complete is one of the good ways during unit test unless you want to test out timeout functionality of the future. Also, there is a java library to test Futures as well, I'm not able to recollect it.