I have a case class Employee
defined as case class Employee(.........fields.....)
I have a method say
def getEmployees(organization: String): Future[Seq[Employee]] = {
val result = employeeClient.getAllEmployees(organization)
// some logic on this list of Employees received from the
client and manipulate it to get finalListOfEmployees and return it
to caller of `getEmployees`//
finalListOfEmployees
//end //
}
Now I test getEmployees
using scala mock. I am not handling exception coming from getEmployees
or not recovering
from it. That means Exception appearing at getAllEmployees
of client method will be traveling back to the caller of getEmployees
.
Now the question is do we need to test this aspect ?
I meant does the following test add any value ??
"Fail with future" in { (mockEmployeeClient.getAllEmployees_).expects("SomeOrganization").returning(Future.failed(new Exception("failed"))
getEmployees("SomeOrganization).failed.futureValue.getMessage shouldBe "failed"
}