ContentRange { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ContentRange other = (ContentRange) obj; return this.first == other.first && this.last == other.last; } ContentRange(long first, long last); long first(); long last(); long length(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testSame() { final ContentRange r = new ContentRange(1, 2); assertTrue(r.equals(r)); }
@Test public void testUnequalNull() { assertFalse(new ContentRange(1, 2).equals(null)); }
@Test public void testUnequalOtherType() { assertFalse(new ContentRange(1, 2).equals(1)); }
@Test public void testUnequalFirst() { assertFalse(new ContentRange(1, 3).equals(new ContentRange(2, 3))); }
@Test public void testUnequalSecond() { assertFalse(new ContentRange(1, 2).equals(new ContentRange(1, 3))); }
@Test public void testEqual() { assertTrue(new ContentRange(1, 2).equals(new ContentRange(1, 2))); }