ScalaTest: Assert exceptions in failed futures (non-blocking)

前端 未结 6 685
夕颜
夕颜 2020-12-24 10:54
import org.scalatest.{ FlatSpec, Matchers, ParallelTestExecution }
import org.scalatest.concurrent.ScalaFutures
import org.apache.thrift.TApplicationException

class         


        
6条回答
  •  时光取名叫无心
    2020-12-24 11:26

    You can also try this Something Simple and Short

    test("some test throwing SQL Exception") {
          val f: Future[Something] = someObject.giveMeAFuture
          recoverToSucceededIf[SQLException](f)
        }
    

提交回复
热议问题