TopicNameComparator extends ScopedIFComparator<TopicNameIF> { @Override public int compare(TopicNameIF o1, TopicNameIF o2) { TopicMapIF tm = o1.getTopicMap(); TopicIF t1 = o1.getType(); TopicIF t2 = o2.getType(); TopicIF untypedname = tm.getTopicBySubjectIdentifier(PSI.getSAMNameType()); if (untypedname == null) { t1 = null; t2 = null; } else { if (untypedname.equals(t1)) t1 = null; if (untypedname.equals(t2)) t2 = null; } if (t1 == null) { if (t2 != null) return -1; } else { if (t2 == null) return 1; } return super.compare(o1, o2); } TopicNameComparator(Collection<TopicIF> scope); @Override int compare(TopicNameIF o1, TopicNameIF o2);  }
@Test public void testIssue439() { TopicMapIF tm = new InMemoryTopicMapStore().getTopicMap(); TopicIF topic = tm.getBuilder().makeTopic(); TopicNameIF name1 = tm.getBuilder().makeTopicName(topic, topic, "value1"); TopicNameIF name2 = tm.getBuilder().makeTopicName(topic, topic, "value2"); Assert.assertEquals(-1, new TopicNameComparator(Collections.EMPTY_LIST).compare(name1, name2)); }