@Test
  public void testSetProperties() throws Exception {
    String clientID = getTestName();
    String queuePrefix = "q:";
    String jmsOptionPrefix = "jms.";
    String baseUri = "amqp://localhost:1234";
    String uri = baseUri + "?" + jmsOptionPrefix + CLIENT_ID_PROP + "=" + clientID;

    // Create a connection factory object
    JmsConnectionFactory cf = new JmsConnectionFactory();

    // Verify the outcome conditions have not been met already
    assertNotEquals("value should not match yet", clientID, cf.getClientID());
    assertNotEquals("value should not match yet", queuePrefix, cf.getQueuePrefix());
    assertNotEquals("value should not match yet", baseUri, cf.getRemoteURI());

    // Set the properties
    Map<String, String> props = new HashMap<String, String>();
    // Add the URI property, itself containing a property option in its query
    props.put("remoteURI", uri);
    // Add another property directly
    props.put("queuePrefix", queuePrefix);
    Map<String, String> unusedProps = cf.setProperties(props);

    // Verify the clientID property option from the URI was applied.
    assertEquals("uri property query option not applied as expected", clientID, cf.getClientID());
    // Verify the direct property was applied
    assertEquals("direct property not applied as expected", queuePrefix, cf.getQueuePrefix());
    // Verify the URI was filtered to remove the applied options
    assertEquals(
        "URI was filtered to remove options that were applied", baseUri, cf.getRemoteURI());

    // Verify the returned map was empty and unmodifiable
    assertTrue("Map should be empty: " + unusedProps, unusedProps.isEmpty());
    try {
      unusedProps.put("a", "b");
      fail("Map should be unmodifiable");
    } catch (UnsupportedOperationException uoe) {
      // expected
    }
  }