Hi,
How can I map multiple assertions to the future:
class TVSetActorSpec extends AsyncFeatureSpec with GivenWhenThen {
implicit override def executionContext =
scala.concurrent.ExecutionContext.Implicits.global
info("As a TV set owner")
info("I want to be able to turn the TV on and off")
info("So I can watch TV when I want")
info("And save energy when I'm not watching TV")
feature("TV power button") {
scenario("User presses power button when TV is off") {
Given("a TV set that is switched off")
val tvSetActor = new TVSetActor
When("the power button is pressed")
tvSetActor ! PressPowerButton
Then("the TV should switch on")
val futureBoolean = tvSetActor ? IsOn
futureBoolean map {
_ => myfunction()
}
}
scenario("User presses power button when TV is on") {
Given("a TV set that is switched on")
val tvSetActor = new TVSetActor
tvSetActor ! PressPowerButton
When("the power button is pressed")
tvSetActor ! PressPowerButton
Then("the TV should switch off")
val futureBoolean = tvSetActor ? IsOn
futureBoolean map {
_ => myfunction()
}
}
}
}
def myfunction() = {
assert(assertion1)
assert(assertion2)
assert(assertion3)
}
If assertion(1) fails will the future fail?
Thanks,
Rachna