### Question:
MetadataTime implements Comparable<MetadataTime> { @Override public int compareTo(MetadataTime mtime) { if (this.type.equals(mtime.getType())) return Long.compare(this.time, mtime.getTime()); else throw new IllegalArgumentException( "Cannot compare different time types: " + this + " and " + mtime); } MetadataTime(long time, TimeType type); static MetadataTime parse(String timestr); static TimeType getType(char code); static char getCode(TimeType type); char getCode(); String encode(); TimeType getType(); long getTime(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(MetadataTime mtime);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testCompareTypesDiffer1() { m1234.compareTo(l1234); }
@Test(expected = IllegalArgumentException.class) public void testCompareTypesDiffer2() { l1234.compareTo(m1234); }
@Test public void testCompareSame() { assertTrue(m1234.compareTo(m1234) == 0); assertTrue(l1234.compareTo(l1234) == 0); }
@Test public void testCompare1() { assertTrue(m1234.compareTo(m5678) < 0); assertTrue(l1234.compareTo(l5678) < 0); }
@Test public void testCompare2() { assertTrue(m5678.compareTo(m1234) > 0); assertTrue(l5678.compareTo(l1234) > 0); }