@Test
public void testOnReceiveSetRegistrationAfterPriorClose() {

    DataTreeNotificationListenerRegistrationActor.killDelay = 1000;
    final ListenerRegistration<?> mockListenerReg2 = mock(ListenerRegistration.class);
    final Runnable mockOnClose2 = mock(Runnable.class);
    final ActorRef subject = getSystem().actorOf(DataTreeNotificationListenerRegistrationActor.props(),
        "testOnReceiveSetRegistrationAfterPriorClose");
    kit.watch(subject);
    subject.tell(new DataTreeNotificationListenerRegistrationActor.SetRegistration(mockListenerReg,
        mockOnClose), ActorRef.noSender());
    subject.tell(CloseDataTreeNotificationListenerRegistration.getInstance(), ActorRef.noSender());
    subject.tell(new DataTreeNotificationListenerRegistrationActor.SetRegistration(mockListenerReg2,
        mockOnClose2), ActorRef.noSender());
    verify(mockListenerReg, timeout(5000)).close();
    verify(mockOnClose, timeout(5000)).run();
    verify(mockListenerReg2, timeout(5000)).close();
    verify(mockOnClose2, timeout(5000)).run();
    kit.expectTerminated(Duration.ofSeconds(5), subject);
}