TypeSubTypeValue implements Comparable<TypeSubTypeValue>, Serializable { @Override public int compareTo(final TypeSubTypeValue typeSubTypeValue) { if (null == typeSubTypeValue) { return 1; } int i = stringComparator.compare(type, typeSubTypeValue.getType()); if (i != 0) { return i; } i = stringComparator.compare(subType, typeSubTypeValue.getSubType()); if (i != 0) { return i; } return stringComparator.compare(value, typeSubTypeValue.getValue()); } TypeSubTypeValue();  TypeSubTypeValue(final String type, final String subType, final String value); String getType(); void setType(final String type); String getValue(); void setValue(final String value); void setSubType(final String subType); String getSubType(); @Override int hashCode(); @Override boolean equals(final Object object); @Override String toString(); @Override int compareTo(final TypeSubTypeValue typeSubTypeValue);  }
@Test public void testComparisonsAreAsExpected() { TypeSubTypeValue typeSubTypeValue = new TypeSubTypeValue("a", "b", "c"); assertEquals(0, typeSubTypeValue.compareTo(new TypeSubTypeValue("a", "b", "c"))); assertTrue(typeSubTypeValue.compareTo(null) > 0); assertTrue(typeSubTypeValue.compareTo(new TypeSubTypeValue()) > 0); assertTrue(typeSubTypeValue.compareTo(new TypeSubTypeValue("1", "b", "c")) > 0); assertTrue(typeSubTypeValue.compareTo(new TypeSubTypeValue("a", "a", "c")) > 0); assertTrue(typeSubTypeValue.compareTo(new TypeSubTypeValue("a", "b", "a")) > 0); assertTrue(typeSubTypeValue.compareTo(new TypeSubTypeValue("b", "a", "c")) < 0); assertTrue(typeSubTypeValue.compareTo(new TypeSubTypeValue("a", "c", "c")) < 0); assertTrue(typeSubTypeValue.compareTo(new TypeSubTypeValue("a", "b", "d")) < 0); }