private void testSettersThrowException(final ActiveMQConnectionFactory cf) {

    String discoveryAddress = RandomUtil.randomString();
    int discoveryPort = RandomUtil.randomPositiveInt();
    long discoveryRefreshTimeout = RandomUtil.randomPositiveLong();
    String clientID = RandomUtil.randomString();
    long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
    long connectionTTL = RandomUtil.randomPositiveLong();
    long callTimeout = RandomUtil.randomPositiveLong();
    int minLargeMessageSize = RandomUtil.randomPositiveInt();
    int consumerWindowSize = RandomUtil.randomPositiveInt();
    int consumerMaxRate = RandomUtil.randomPositiveInt();
    int confirmationWindowSize = RandomUtil.randomPositiveInt();
    int producerMaxRate = RandomUtil.randomPositiveInt();
    boolean blockOnAcknowledge = RandomUtil.randomBoolean();
    boolean blockOnDurableSend = RandomUtil.randomBoolean();
    boolean blockOnNonDurableSend = RandomUtil.randomBoolean();
    boolean autoGroup = RandomUtil.randomBoolean();
    boolean preAcknowledge = RandomUtil.randomBoolean();
    String loadBalancingPolicyClassName = RandomUtil.randomString();
    int dupsOKBatchSize = RandomUtil.randomPositiveInt();
    int transactionBatchSize = RandomUtil.randomPositiveInt();
    long initialWaitTimeout = RandomUtil.randomPositiveLong();
    boolean useGlobalPools = RandomUtil.randomBoolean();
    int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
    int threadPoolMaxSize = RandomUtil.randomPositiveInt();
    long retryInterval = RandomUtil.randomPositiveLong();
    double retryIntervalMultiplier = RandomUtil.randomDouble();
    int reconnectAttempts = RandomUtil.randomPositiveInt();
    boolean failoverOnServerShutdown = RandomUtil.randomBoolean();

    try {
      cf.setClientID(clientID);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setClientFailureCheckPeriod(clientFailureCheckPeriod);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setConnectionTTL(connectionTTL);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setCallTimeout(callTimeout);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setMinLargeMessageSize(minLargeMessageSize);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setConsumerWindowSize(consumerWindowSize);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setConsumerMaxRate(consumerMaxRate);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setConfirmationWindowSize(confirmationWindowSize);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setProducerMaxRate(producerMaxRate);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setBlockOnAcknowledge(blockOnAcknowledge);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setBlockOnDurableSend(blockOnDurableSend);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setBlockOnNonDurableSend(blockOnNonDurableSend);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setAutoGroup(autoGroup);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setPreAcknowledge(preAcknowledge);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setDupsOKBatchSize(dupsOKBatchSize);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setTransactionBatchSize(transactionBatchSize);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setUseGlobalPools(useGlobalPools);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setThreadPoolMaxSize(threadPoolMaxSize);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setRetryInterval(retryInterval);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setRetryIntervalMultiplier(retryIntervalMultiplier);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }
    try {
      cf.setReconnectAttempts(reconnectAttempts);
      Assert.fail("Should throw exception");
    } catch (IllegalStateException e) {
      // OK
    }

    cf.getStaticConnectors();
    cf.getClientID();
    cf.getClientFailureCheckPeriod();
    cf.getConnectionTTL();
    cf.getCallTimeout();
    cf.getMinLargeMessageSize();
    cf.getConsumerWindowSize();
    cf.getConsumerMaxRate();
    cf.getConfirmationWindowSize();
    cf.getProducerMaxRate();
    cf.isBlockOnAcknowledge();
    cf.isBlockOnDurableSend();
    cf.isBlockOnNonDurableSend();
    cf.isAutoGroup();
    cf.isPreAcknowledge();
    cf.getConnectionLoadBalancingPolicyClassName();
    cf.getDupsOKBatchSize();
    cf.getTransactionBatchSize();
    cf.isUseGlobalPools();
    cf.getScheduledThreadPoolMaxSize();
    cf.getThreadPoolMaxSize();
    cf.getRetryInterval();
    cf.getRetryIntervalMultiplier();
    cf.getReconnectAttempts();

    cf.close();
  }