Hi Kostas, The usual way to do this is to use expectNoMsg() which will wait for a configurable amount of time and fail if a message arrives during that time.
-Endre On Tue, Oct 27, 2015 at 4:35 PM, Kostas kougios < [email protected]> wrote: > I want to test the negative of a use case, when a msg shall not be send. > > TestKit doesn't seem to have something to say dontExpectAnyMessage. > TestProbe has a field of how many msgs are available to the probe, but that > seems like a hack. > > I've also tried mocking ActorRef and verify(ref.tell..., 0 times) but I > get a classcast exception. > > java.lang.ClassCastException: > akka.actor.ActorRef$$EnhancerByMockitoWithCGLIB$$12648026 cannot be cast to > akka.actor.ScalaActorRef > > It seems there is no workaround for this class cast exception as the akka > class hierarchy doesn't allow it. > > What's the way to verify a msg is not send? > > Thanks > > -- > >>>>>>>>>> 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. > -- Akka Team Typesafe - Reactive apps on the JVM Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> 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.
