At the moment if I need to test that a value v
of Try[T]
type is Success(t)
I do like:
v.isSuccess shouldBe true
I wonder if there are probably some better ways. For example, for Option[T]
we can assert like:
t shouldBe defined
Probably there is something like this for Try[T]
but I am not aware and searching the web does not help.
So far I came up with this solution:
Based on this section of the ScalaTest docs we declare such symbol value:
val successful = 'success
and then assert like this:
CampaignRowsPage.reserveInventory shouldBe successful
Looks good to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With