ScalaTest: how to assert Try values ​​correctly?

Right now, if I need to check that the value vof Try[T]type is what Success(t)I like: v.isSuccess shouldBe true I wonder if there are probably a few better ways. For example, for Option[T]we can argue that: t shouldBe defined Probably for Try[T]there is something similar, but I do not know, and searching the Internet does not help.

+4
source share
1 answer

So far I have come up with this solution: Based on the ScalaTest docs in this section, we declare the value of the symbol: val successful = 'successand then do the following:

CampaignRowsPage.reserveInventory shouldBe successful

Looks nice.

+3
source

Source: https://habr.com/ru/post/1673341/


All Articles