How to test a Try[T] with ScalaTest correctly?

后端 未结 3 1880
死守一世寂寞
死守一世寂寞 2020-12-20 16:11

I have a method that returns a Try object:

def doSomething(p: SomeParam): Try[Something] = {
  // code
}

I now want to test th

3条回答
  •  心在旅途
    2020-12-20 16:17

    Just check to see that it is the success type with your return value:

    maybeRes shouldBe Success("moo")
    

提交回复
热议问题