I am trying to write the unit test case for my private method in scala using MockitoSugar but it is throwing Can't find a private method exception. Here is my code.
object ActivityRepo{
private def addActivity(activity:Activity):Future[Activity]={
//doing DB calls
}
}
Unit test:
"Activity Repo Test" must {
"add Activity" in {
// doing mock for the DB calls
val addActivity = PrivateMethod[Future[Activity]]('addActivity)
val result = ActivityRepo invokePrivate addActivity (activity)
// doing assertions
}
}
Where is the mistake?