@Test
public void testOnReceiveCloseListenerRegistrationBeforeSetRegistration() {

    final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
            "testOnReceiveSetRegistrationAfterPriorClose");
    kit.watch(subject);
    subject.tell(CloseDataTreeNotificationListenerRegistration.getInstance(), kit.getRef());
    kit.expectMsgClass(Duration.ofSeconds(5), CloseDataTreeNotificationListenerRegistrationReply.class);
    subject.tell(new DataTreeNotificationListenerRegistrationActor.SetRegistration(mockListenerReg,
        mockOnClose), ActorRef.noSender());
    verify(mockListenerReg, timeout(5000)).close();
    verify(mockOnClose, timeout(5000)).run();
    kit.expectTerminated(Duration.ofSeconds(5), subject);
}