bonk2.setMessage("m");
assertEquals(0, bonk1.compareTo(bonk2));
}
public void testCompareToWithDataStructures() {
Insanity insanity1 = new Insanity();
Insanity insanity2 = new Insanity();
// Both empty.
expectEquals(insanity1, insanity2);
insanity1.setUserMap(new HashMap<Numberz, Long>());
// insanity1.map = {}, insanity2.map = null
expectGreaterThan(insanity1, insanity2);
// insanity1.map = {2:1}, insanity2.map = null
insanity1.getUserMap().put(Numberz.TWO, 1l);
expectGreaterThan(insanity1, insanity2);
// insanity1.map = {2:1}, insanity2.map = {}
insanity2.setUserMap(new HashMap<Numberz, Long>());
expectGreaterThan(insanity1, insanity2);
// insanity1.map = {2:1}, insanity2.map = {2:2}
insanity2.getUserMap().put(Numberz.TWO, 2l);
expectLessThan(insanity1, insanity2);
// insanity1.map = {2:1, 3:5}, insanity2.map = {2:2}
insanity1.getUserMap().put(Numberz.THREE, 5l);
expectGreaterThan(insanity1, insanity2);
// insanity1.map = {2:1, 3:5}, insanity2.map = {2:1, 4:5}
insanity2.getUserMap().put(Numberz.TWO, 1l);
insanity2.getUserMap().put(Numberz.FIVE, 5l);
expectLessThan(insanity1, insanity2);
}