ItemComparator implements Comparator, Serializable { @Override public boolean equals(Object obj) { if (!(obj instanceof ItemComparator)) { return false; } ItemComparator other = (ItemComparator) obj; return equalsWithNull(element, other.element) && equalsWithNull(qualifier, other.qualifier) && equalsWithNull(language, other.language) && (max == other.max); } ItemComparator(String element, String qualifier, String language,
                          boolean max); @Override int compare(Object first, Object second); @Override boolean equals(Object obj); @Override int hashCode();  }
@Test @SuppressWarnings( {"ObjectEqualsNull", "IncompatibleEquals"}) public void testEquals() { ItemComparator ic = new ItemComparator("test", "one", Item.ANY, true); ItemComparator target; assertFalse("testEquals 0", ic.equals(null)); assertFalse("testEquals 1", ic.equals("test one")); target = new ItemComparator("test1", "one", Item.ANY, true); assertFalse("testEquals 2", ic.equals(target)); target = new ItemComparator("test", "one1", Item.ANY, true); assertFalse("testEquals 3", ic.equals(target)); target = new ItemComparator("test", "one", "es", true); assertFalse("testEquals 4", ic.equals(target)); target = new ItemComparator("test1", "one", Item.ANY, false); assertFalse("testEquals 5", ic.equals(target)); target = new ItemComparator("test", "one", Item.ANY, true); assertTrue("testEquals 6", ic.equals(target)); }