@Test
public void testHashCode() {

  TypedRange<String> range1a = new TypedRange<String>(123, 456, "hi mom");
  TypedRange<String> range1b = new TypedRange<String>(123, 456, "hi mom");
  Assert.assertEquals(range1a.hashCode(), range1b.hashCode());
  Set<Integer> hashCodes = new HashSet<Integer>();
  hashCodes.add(range1a.hashCode());
  hashCodes.add(new TypedRange<String>(123 + 1, 456, "hi mom").hashCode()); // offset changed
  hashCodes.add(new TypedRange<String>(123, 456 + 1, "hi mom").hashCode()); // length changed
  hashCodes.add(new TypedRange<String>(123 + 1, 456, "x").hashCode()); // metadata changed
  hashCodes.add(new TypedRange<String>(123 + 1, 456, null).hashCode()); // no metadata at all
  // Assert that all 4 hash codes are unique
  Assert.assertEquals(5, hashCodes.size());
}