I am rewriting tests that used to test an Akka actor that responded with a String, right now, we use a function that returns a Future[String]
. So rewriting the tests using AsyncFunSuiteLike.
Currently I'm looking at a test that has to assert multiple Futures, but I don't seem to understand how to achieve it with AsyncFunSuiteLike.
My test looks as follows:
test("Error responses") {
NanoHTTPD.Response.Status.values().filter(status => status.getRequestStatus >= 400).map {
status => {
val statusCode = status.getRequestStatus
httpService.setStatusCode(status)
val responseBody = s"Request failed with status $status"
httpService.setResponseContent(responseBody)
val errorMessage = s"Error response (${status.getRequestStatus}): $responseBody"
myobject.request("123456").map {
resp => assert(resp === "....")
}
}
}
}
But I am getting an error type missmatch. Expected: Future[Assertion] actual: List[Future[scalatest.Assertion]]
Any idea on how can I achieve multiple assertions within a single test like that?