vendredi 29 mai 2015

How do I write a Scala unit test to verify that a function is called with some particular function as a parameter?

I have a class:

class SomeDao {
  this: support =>

  def get(id:Long): Option[SomeDto] = {
     support.sprocCall(SomeDto.fromResultSet, SomeDao.getSproc, id)
  }  
}

SomeDto.fromResultSet is actually a Function1 [WrapperResultSet, SomeDto].

Is it possible to verify that support.sprocCall has been called with the correct function as the first parameter?

Aucun commentaire:

Enregistrer un commentaire