Hi Dennis, I was just about to suggest that. Great that you found it yourself.
B/ On 22 August 2014 at 12:40:50, Dennis Vriend ([email protected]) wrote: Solved I guess, this also works, use a TestProbe, no need to clear the queue, just create a new Probe! it should "send RequireAck and transition to state WaitingForAckTicket and update its state to TransactionData" in { val testProbe = TestProbe() val ticketDispenser = TestProbe() val fsm = TestFSMRef(new TestTicketTransaction(ticketDispenser.ref)) val testFsm: TestActorRef[TestTicketTransaction] = fsm testProbe.send(testFsm, GetTicketNumber("a", "b")) testProbe.expectMsg(RequireAck(10L)) assert(fsm.stateName == WaitingForAckTicket) assert(fsm.stateData == TransactionData("a", "b")) } Op vrijdag 22 augustus 2014 12:22:40 UTC+2 schreef Dennis Vriend: 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. -- Björn Antonsson Typesafe – Reactive Apps on the JVM twitter: @bantonsson -- >>>>>>>>>> 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.
