String buildUrl( JmsDelegate delegate, boolean debug ) {
    StringBuilder finalUrl = new StringBuilder( delegate.amqUrl.trim() );

    // verify user hit the checkbox on the dialogue *and* also has not specified these values on the URL already
    // end result: default to SSL settings in the URL if present, otherwise use data from the security tab
    if ( delegate.sslEnabled && !finalUrl.toString().contains( "sslEnabled" ) ) {
      appendSslOptions( delegate, finalUrl, debug );
    }

    return finalUrl.toString();
  }
@Test public void testUrlBuildSslOptionsParamsExist() {

    ActiveMQProvider provider = new ActiveMQProvider();
    JmsDelegate delegate = new JmsDelegate( Collections.singletonList( provider ) );

    delegate.amqUrl = AMQ_URL_BASE + "?foo=bar";
    delegate.sslEnabled = true;
    delegate.sslTruststorePath = TRUST_STORE_PATH_VAL;
    delegate.sslTruststorePassword = TRUST_STORE_PASS_VAL;

    String urlString = provider.buildUrl( delegate, false );

    try {
      URI url = new URI( urlString );
    } catch ( URISyntaxException e ) {
      fail( e.getMessage() );
    }

    assertTrue( "Missing trust store path", urlString.contains( "trustStorePath=" + TRUST_STORE_PATH_VAL ) );
    assertTrue( "Missing trust store password", urlString.contains( "trustStorePassword=" + TRUST_STORE_PASS_VAL ) );

    assertTrue( "URL base incorrect", urlString.startsWith( AMQ_URL_BASE + "?" ) );

    delegate.amqUrl += ";";

    urlString = provider.buildUrl( delegate,false );

    try {
      URI url = new URI( urlString );
    } catch ( URISyntaxException e ) {
      fail( e.getMessage() );
    }

    assertTrue( "Missing trust store path", urlString.contains( "trustStorePath=" + TRUST_STORE_PATH_VAL ) );
    assertTrue( "Missing trust store password", urlString.contains( "trustStorePassword=" + TRUST_STORE_PASS_VAL ) );

    assertTrue( "URL base incorrect", urlString.startsWith( AMQ_URL_BASE + "?" ) );
  }