Hussachai Puripunpinyo
1 min readAug 9, 2020

--

Thanks for the comment. I wrote this article long time ago when I was new to Scala. There are, of course, ways of doing this in more idiomatic fashion. Anyway, the last example is not broken. `shouldEqual` will throw TestFailedException which results Future.failed and for-comprehension is basically a syntactic sugar for flatMap. At the end, there will be only one Future that returns from the block. If one of the chained future fails, it won't yield `success`. Instead, the Future.failed(exception) will be propagated and cause the test to fail.

--

--

Hussachai Puripunpinyo
Hussachai Puripunpinyo

Written by Hussachai Puripunpinyo

Keep changing characters until it compiles—that's what I do. https://hussachai.puripunpinyo.com

No responses yet