title: How to Mock akka Actor for unit Test?
body: <pre><code>@Singleton
  class EventPublisher @Inject() (@Named("rabbit-mq-event-update-actor") rabbitControlActor: ActorRef)
  (implicit ctx: ExecutionContext) {
  
  def publish(event: Event): Unit = {
           logger.info("Publishing Event: {}", toJsObject(event), routingKey)
           rabbitControlActor ! Message.topic(shipmentStatusUpdate, routingKey = "XXX")
   }
  }
  </code></pre>
  
  <p>I want to write a unit test to verify if this <code>publish</code> function is called</p>
  
  <blockquote>
    <p>rabbitControlActor ! Message.topic(shipmentStatusUpdate, routingKey = "XXX")</p>
  </blockquote>
  
  <p>is called only once.
  I am using <code>spingo</code> to publish messages to Rabbit MQ. 
  I am using <code>Playframework 2.6.x</code> and scala <code>2.12</code>.</p>