pekko/akka-persistence-testkit/src/test/scala/akka/persistence/testkit/scaladsl/SnapshotSerializeSpec.scala

28 lines
771 B
Scala
Raw Normal View History

/*
* Copyright (C) 2019-2020 Lightbend Inc. <https://www.lightbend.com>
*/
package akka.persistence.testkit.scaladsl
import java.io.NotSerializableException
import akka.actor.Props
import akka.persistence.SaveSnapshotFailure
import akka.persistence.testkit._
class SnapshotSerializeSpec extends CommonSnapshotTests {
override lazy val system = initSystemWithEnabledPlugin("SnapshotSerializeSpec", true, true)
override def specificTests(): Unit =
"fail if tries to save nonserializable snapshot" in {
val pid = randomPid()
val a = system.actorOf(Props(classOf[A], pid, Some(testActor)))
a ! NewSnapshot(new C)
expectMsg((List.empty, 0L))
expectMsgPF() { case SaveSnapshotFailure(_, _: NotSerializableException) => }
}
}