@Test
public void objectNameKeys() throws Exception {

    // real order that is examined
    List<String> realJmxAclPids = Arrays.asList(
        "jmx.acl.org.apache.activemq.Broker.amq1.Queue.q2",
        "jmx.acl.org.apache.activemq.Broker.amq1.Queue._",
        "jmx.acl.org.apache.activemq.Broker._.Queue.q1",
        "jmx.acl.org.apache.activemq.Broker._.Queue",
        "jmx.acl.org.apache.activemq.Broker.amq2",
        "jmx.acl.org.apache.activemq.Broker._",
        "jmx.acl.org.apache.activemq._",
        "jmx.acl.org.apache.activemq",
        "jmx.acl");
    // ActiveMQ queues from broker amq1
    ObjectName o11 = new ObjectName("org.apache.activemq:type=Broker,brokerName=amq1,destinationType=Queue,destinationName=q1");
    ObjectName o12 = new ObjectName("org.apache.activemq:type=Broker,brokerName=amq1,destinationType=Queue,destinationName=q2");
    ObjectName o13 = new ObjectName("org.apache.activemq:type=Broker,brokerName=amq1,destinationType=Queue,destinationName=q3");
    String k1 = RBACDecorator.pidListKey(realJmxAclPids, o11);
    String k2 = RBACDecorator.pidListKey(realJmxAclPids, o12);
    String k3 = RBACDecorator.pidListKey(realJmxAclPids, o13);
    assertThat(k1, not(equalTo(k2)));
    assertThat(k1, equalTo(k3));
}