### Question:
LWM2MID implements Comparable<LWM2MID> { @Override public int compareTo(LWM2MID that) { if (this.stringId == null) { return that.stringId == null ? 0 : -1; } else { return that.stringId == null ? 1 : this.stringId.compareTo(that.stringId); } } LWM2MID(String stringId);  LWM2MID(int intId); static final LWM2MID from(0); static final LWM2MID from(1); static final LWM2MID from(2); static final LWM2MID from(3); static final LWM2MID from(4); static final LWM2MID from(5); static final LWM2MID from(6); static final LWM2MID from(7); static final LWM2MID from(8); static final LWM2MID from(9); static final LWM2MID from(10); static final LWM2MID from(11); static final LWM2MID from(12); static final LWM2MID from(13); static final LWM2MID from(14); static final LWM2MID from(15); static final LWM2MID from(16); static LWM2MID create(); static LWM2MID from(String stringId); static LWM2MID from(int intId); String stringValue(); int intValue(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @Override int compareTo(LWM2MID that);  }### Answer:
@Test public void testCompareTo() throws Exception { assertEquals(0, new LWM2MID(null).compareTo(new LWM2MID(null))); assertEquals(-1, new LWM2MID(null).compareTo(new LWM2MID("alma"))); assertEquals(1, new LWM2MID("alma").compareTo(new LWM2MID(null))); assertEquals(-10, new LWM2MID("alma").compareTo(new LWM2MID("korte"))); assertEquals(10, new LWM2MID("korte").compareTo(new LWM2MID("alma"))); }
@Test(expected=NullPointerException.class) public void testCompareToNull() throws Exception { new LWM2MID(null).compareTo(null); }