RangeEdgePartition extends RangePartition { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof RangeEdgePartition)) { return false; } RangeEdgePartition other = (RangeEdgePartition)obj; return super.equals(other) && value == other.value && lowerBound == other.lowerBound && upperBound == other.upperBound; } RangeEdgePartition(String label, long value, int lower, int upper); long getValue(); int getLowerBound(); int getUpperBound(); @Override RangeEdgePartition clone(); @Override int hashCode(); @Override boolean equals(Object obj); long encodeBounds();  }
@Test public void requireThatEqualsIsImplemented() { RangeEdgePartition lhs = new RangeEdgePartition("foo=10", 10, 5, 10); assertTrue(lhs.equals(lhs)); assertFalse(lhs.equals(new Object())); RangeEdgePartition rhs = new RangeEdgePartition("foo=20", 20, 0, 0); assertFalse(lhs.equals(rhs)); rhs = new RangeEdgePartition("foo=10", 10, 5, 10); assertTrue(lhs.equals(rhs)); assertFalse(lhs.equals(new RangeEdgePartition("foo=10", 10, 5, 11))); assertFalse(lhs.equals(new RangeEdgePartition("foo=10", 10, 6, 10))); assertFalse(lhs.equals(new RangeEdgePartition("foo=10", 11, 5, 10))); assertFalse(lhs.equals(new RangeEdgePartition("foo=11", 10, 5, 10))); }