testkit

How to test that Akka actor was created in Scala

依然范特西╮ 提交于 2020-01-21 03:03:05
问题 I'm trying to write a test that will verify that my actor below is creating a heartBeatExpireWorker and a heartBeatAccepter, but I have no idea how to do it. First I was thinking I could use Mockhito mock or a spy in place of context and then verify that I called actorOf, but I can't figure out a way to inject the context without breaking the Akka testing framework. Then, I was thinking that I could send an Identify message to the workers to verify that they exist. But it occurred to me that

Howto test Custom Json Objects with Spray Routing

时光怂恿深爱的人放手 提交于 2019-12-12 14:22:59
问题 I'm creating a Rest API with spray-routing on top of mongodb for some CRUD operations, this all works fine, expect whenever I try to test it with specs2 the following specification class RestServiceSpec extends Specification with Specs2RouteTest with RoutingRestService // database initialization removed for clarity "The rest service" should "have a player called 'Theo TestPlayer' in the db" in { Get("/api/1.0/player/" + player1._id) ~> restRoute ~> check { entityAs[Player] must be equalTo

java.lang.NoSuchMethodError with Scala actors

99封情书 提交于 2019-12-11 17:55:03
问题 I have a simple Scala application (taken from here) which I want to test. The whole project is compiled successfully with SBT. However, when I launch the tests with sbt test I get the following error message: Could not run test ConnectionTest:java.lang.NoSuchMethodError: akka.actor.Props$.apply(Lscala/Function0;)Lakka/actor/Props; From the internet search, I get the impression that some of my versioning is not compatible but that is merely a guess. What may be wrong? [Test Case] import akka

How to test that Akka actor was created in Scala

北慕城南 提交于 2019-11-30 12:46:22
I'm trying to write a test that will verify that my actor below is creating a heartBeatExpireWorker and a heartBeatAccepter, but I have no idea how to do it. First I was thinking I could use Mockhito mock or a spy in place of context and then verify that I called actorOf, but I can't figure out a way to inject the context without breaking the Akka testing framework. Then, I was thinking that I could send an Identify message to the workers to verify that they exist. But it occurred to me that that wouldn't work either because the Akka TestKit doesn't seem to create children actors of an actor