Class SerializationTestKit

java.lang.Object
org.apache.pekko.actor.testkit.typed.scaladsl.SerializationTestKit

public class SerializationTestKit extends Object
Utilities to test serialization.
  • Constructor Details

    • SerializationTestKit

      public SerializationTestKit(ActorSystem<?> system)
  • Method Details

    • verifySerialization

      public <M> M verifySerialization(M obj)
      Verify serialization roundtrip. Throws exception from serializer if obj can't be serialized and deserialized. Also tests that the deserialized object is equal to obj, and if not an AssertionError is thrown.

      Parameters:
      obj - the object to verify
      Returns:
      the deserialized object
    • verifySerialization

      public <M> M verifySerialization(M obj, boolean assertEquality)
      Verify serialization roundtrip. Throws exception from serializer if obj can't be serialized and deserialized.

      Parameters:
      obj - the object to verify
      assertEquality - if true the deserialized object is verified to be equal to obj, and if not an AssertionError is thrown
      Returns:
      the deserialized object