Skip to content

Instantly share code, notes, and snippets.

@markglh
markglh / 0_reuse_code.js
Created July 27, 2016 18:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@markglh
markglh / ParentChildActorSpec.scala
Created October 11, 2016 13:43
Testing parent and child actors using Akka Testkit
import SomeActor.{SendToChild, SendToParent}
import akka.actor.{Actor, ActorRef, ActorSystem, Props}
import akka.event.LoggingReceive
import akka.testkit.{TestActorRef, TestKit, TestProbe}
import org.scalatest.{BeforeAndAfterAll, FreeSpecLike, GivenWhenThen, Matchers}
import scala.concurrent.duration.DurationInt
class ParentChildActorSpec extends TestKit(ActorSystem("some-test-system"))
with GivenWhenThen
private def processing(responseCollector: ResponseCollector, manager: ActorRef, retryAttempt: Int = 0): Receive = LoggingReceive {
def switchToReadyState(latestProcessedSeq: Option[CompoundSequenceNumber]) = {
context.become(readyToProcess(latestProcessedSeq))
unstashAll()
}
receiveCheckpoint(responseCollector.latestConfirmedEventSeq, Some(manager)).orElse {
case EventProcessed(sequenceNo, successful) =>