@Test
public void invalidTargetFormatThrowsConnectionConfigurationInvalidException() {

    final Connection connection = ConnectivityModelFactory.newConnectionBuilder(CONNECTION_ID,
            ConnectionType.AMQP_091, ConnectivityStatus.OPEN, TestConstants.getUriOfNewMockServer())
            .targets(Collections.singletonList(ConnectivityModelFactory.newTargetBuilder()
                    .address("exchangeOnly")
                    .authorizationContext(TestConstants.Authorization.AUTHORIZATION_CONTEXT)
                    .topics(Topic.TWIN_EVENTS)
                    .build()))
            .build();
    final ThrowableAssert.ThrowingCallable props1 =
            () -> RabbitMQClientActor.propsForTests(connection, Actor.noSender(), Actor.noSender(), null);
    final ThrowableAssert.ThrowingCallable props2 =
            () -> RabbitMQClientActor.propsForTests(connection, Actor.noSender(), Actor.noSender(),
                    rabbitConnectionFactoryFactory
            );
    Stream.of(props1, props2)
            .forEach(throwingCallable ->
                    assertThatExceptionOfType(ConnectionConfigurationInvalidException.class)
                            .isThrownBy(throwingCallable)
                            .withMessageContaining("exchangeOnly")
                            .withNoCause()
            );
}