Попробуйте следующее
class SapOnlineKafkaOnlineSpec extends AsyncFeatureSpec with Matchers
with GivenWhenThen
with BeforeAndAfter
with BeforeAndAfterAll {
def withKafkaAndSap(testCode: ActorRef => Future[Assertion]) = {
val actor = ...
testCode(actor)
}
feature("Detect Kafka and SAP availability") {
info("As a technical user, I want to be notified in real time, if Kafka and SAP is up and running or not.")
scenario("SAP and Kafka are available") {
withKafkaAndSap { listner =>
Given("I am waiting for the current state message")
When("I am receive the state message")
Then("it should contain `SAP and Kafka are online`")
succeed
}
}
}
}
Обратите внимание, что тип параметра фиксатора кредита должен быть
testCode: ActorRef => Future[Assertion]
вместо ActorRef => Any
, и мы расширяем просто AsyncFeatureSpec
вместо fixture.AsyncFeatureSpec