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

后端 未结 3 1874
死守一世寂寞
死守一世寂寞 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:34

    Alternatively

    import org.scalatest.TryValues._
    
    // ... 
    
    maybeRes.success.value should be "moo"
    

提交回复
热议问题