This question seems pretty obvious I know, but i've tried everything that is written on the documentation and I cant't mock a single method on any classes.
For this test, I am using scalaMock 3 for Scala 2.10 and ScalaTest 2
DateServiceTest.scala
@RunWith(classOf[JUnitRunner])
class DateServiceTest extends FunSuite with MockFactory{
val conf = new SparkConf().setAppName("Simple Application").setMaster("local")
val sc = new SparkContext(conf)
implicit val sqlc = new SQLContext(sc)
val m = mock[DateService]
(m.getDate _).expects().returning(Some(new DateTime)) // Error here
}
DateService.scala
class DateService extends Serializable {
def getDate(implicit sqlc: SQLContext): Option[DateTime] = {
Some(new DateTime(loadDateFromDatabase(sqlc)))
}
}
This seems pretty simple for me, but the expectation is Throwing me this error
type mismatch; found : Option[org.joda.time.DateTime] required: ? ⇒ ?
Am I doing something wrong here? Is there another way to set the expectations of a method ?
Aucun commentaire:
Enregistrer un commentaire