@Test
public void testCompare() {

    List<QName> names = new LinkedList<>();
    QName name1 = new QName("localonly");
    names.add(name1);
    QName name2 = new QName(XMLConstants.XML_NS_URI, "xhtml", XMLConstants.XML_NS_PREFIX);
    names.add(name2);
    QName name3 = new QName(NamespaceRegistry.NAMESPACE_JCR, "UpperCase", NamespaceRegistry.PREFIX_JCR);
    names.add(name3);
    QName name4 = new QName(NamespaceRegistry.NAMESPACE_JCR, "primaryType", NamespaceRegistry.PREFIX_JCR);
    names.add(name4);
    QName name5 = new QName(NamespaceRegistry.NAMESPACE_JCR, "PrimaryType", NamespaceRegistry.PREFIX_JCR);
    names.add(name5);
    Collections.sort(names, new QNameComparator());
    
    Assert.assertThat(names, Matchers.contains(name2, name5, name4, name3, name1));
}