@Test
  public void testToSerializable() {
    TestActorRef<Actor> testActor = factory.createTestActor(MessageCollectorActor.props());
    RegisterChangeListener registerChangeListener =
        new RegisterChangeListener(
            TestModel.TEST_PATH, testActor, AsyncDataBroker.DataChangeScope.BASE);

    ListenerRegistrationMessages.RegisterChangeListener serialized =
        registerChangeListener.toSerializable();

    NormalizedNodeMessages.InstanceIdentifier path = serialized.getInstanceIdentifierPath();

    assertEquals(
        "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", path.getCode(0));
    assertEquals(
        Serialization.serializedActorPath(testActor), serialized.getDataChangeListenerActorPath());
    assertEquals(AsyncDataBroker.DataChangeScope.BASE.ordinal(), serialized.getDataChangeScope());
  }
  @Test
  public void testFromSerializable() {
    TestActorRef<Actor> testActor = factory.createTestActor(MessageCollectorActor.props());
    RegisterChangeListener registerChangeListener =
        new RegisterChangeListener(
            TestModel.TEST_PATH, testActor, AsyncDataBroker.DataChangeScope.SUBTREE);

    ListenerRegistrationMessages.RegisterChangeListener serialized =
        registerChangeListener.toSerializable();

    RegisterChangeListener fromSerialized =
        RegisterChangeListener.fromSerializable(getSystem(), serialized);

    assertEquals(TestModel.TEST_PATH, registerChangeListener.getPath());
    assertEquals(
        testActor.path().toString(), fromSerialized.getDataChangeListenerPath().toString());
    assertEquals(AsyncDataBroker.DataChangeScope.SUBTREE, fromSerialized.getScope());
  }
 @After
 public void shutDown() {
   factory.close();
 }