@Test
public void handleRecoverSession() throws JMSException {

    new TestKit(actorSystem) {{
        final Props props = JMSConnectionHandlingActor.props(connection, e -> {}, jmsConnectionFactory);
        final ActorRef connectionHandlingActor = watch(actorSystem.actorOf(props));
        final TestProbe origin = TestProbe.apply(actorSystem);
        final JmsSession existingSession = Mockito.mock(JmsSession.class);
        connectionHandlingActor.tell(
                new AmqpClientActor.JmsRecoverSession(origin.ref(), mockConnection, existingSession),
                getRef());
        final AmqpClientActor.JmsSessionRecovered recovered =
                expectMsgClass(AmqpClientActor.JmsSessionRecovered.class);
        assertThat(recovered.getOrigin()).contains(origin.ref());
        assertThat(recovered.getSession()).isSameAs(mockSession);
        verify(existingSession).close();
        verify(mockConnection).createSession(anyInt());
        verify(mockSession, times(connection.getSources()
                .stream()
                .mapToInt(s -> s.getAddresses().size() * s.getConsumerCount())
                .sum())).createConsumer(any());
    }};
}