I have some test:
class MyTest extends TestKit(ActorSystem("TestCluster")) with
ImplicitSender with FlatSpecLike with BeforeAndAfterAll {
"TicketTransaction" should "should be in Idle state and data must be
Uninitialized when created" in {
val ticketDispenserProbe = TestProbe()
val fsm = TestFSMRef(new
TestTicketTransaction(ticketDispenserProbe.ref))
val testFsm: TestActorRef[TestTicketTransaction] = fsm
assert(fsm.stateName == Idle)
assert(fsm.stateData == Uninitialized)
clear()
}
it should "send RequireAck and transition to state WaitingForAckTicket and
update its state to TransactionData" in {
val ticketDispenserProbe = TestProbe()
val fsm = TestFSMRef(new
TestTicketTransaction(ticketDispenserProbe.ref))
val testFsm: TestActorRef[TestTicketTransaction] = fsm
val transactionId = "AAA"
val campaignId = "BBB"
testFsm ! GetTicketNumber(transactionId, campaignId)
expectMsg(RequireAck(10L))
assert(fsm.stateName == WaitingForAckTicket)
assert(fsm.stateData == TransactionData(transactionId, campaignId))
clear()
}
}
I want to clear the queue for the next test. I can not find any clear
method, this came close:
def clear(): Unit = {
receiveWhile(200 milliseconds) {
case msg @ _ =>
}
}
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.