RangeImpl implements Range { @Override public boolean equals(Object o) { if ( this == o ) return true; if ( !(o instanceof RangeImpl) ) return false; RangeImpl range = (RangeImpl) o; if ( lowBoundary != range.lowBoundary ) return false; if ( highBoundary != range.highBoundary ) return false; if ( lowEndPoint != null ? !lowEndPoint.equals( range.lowEndPoint ) : range.lowEndPoint != null ) return false; return highEndPoint != null ? highEndPoint.equals( range.highEndPoint ) : range.highEndPoint == null; } RangeImpl();  RangeImpl(RangeBoundary lowBoundary, Comparable lowEndPoint, Comparable highEndPoint, RangeBoundary highBoundary); @Override RangeBoundary getLowBoundary(); @Override Comparable getLowEndPoint(); @Override Comparable getHighEndPoint(); @Override RangeBoundary getHighBoundary(); @Override Boolean includes(Object param); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void equals() { RangeImpl rangeImpl = new RangeImpl(Range.RangeBoundary.OPEN, 10, 15, Range.RangeBoundary.OPEN); Assert.assertEquals(rangeImpl, rangeImpl); RangeImpl rangeImpl2 = new RangeImpl(Range.RangeBoundary.OPEN, 10, 15, Range.RangeBoundary.OPEN); Assert.assertEquals(rangeImpl, rangeImpl2); rangeImpl2 = new RangeImpl(Range.RangeBoundary.OPEN, 10, 15, Range.RangeBoundary.CLOSED); Assert.assertNotEquals(rangeImpl, rangeImpl2); rangeImpl2 = new RangeImpl(Range.RangeBoundary.CLOSED, 10, 15, Range.RangeBoundary.OPEN); Assert.assertNotEquals(rangeImpl, rangeImpl2); rangeImpl2 = new RangeImpl(Range.RangeBoundary.CLOSED, 10, 15, Range.RangeBoundary.CLOSED); Assert.assertNotEquals(rangeImpl, rangeImpl2); rangeImpl2 = new RangeImpl(Range.RangeBoundary.CLOSED, 12, 15, Range.RangeBoundary.CLOSED); Assert.assertNotEquals(rangeImpl, rangeImpl2); rangeImpl2 = new RangeImpl(Range.RangeBoundary.CLOSED, 12, 17, Range.RangeBoundary.CLOSED); Assert.assertNotEquals(rangeImpl, rangeImpl2); rangeImpl = new RangeImpl(); Assert.assertEquals(rangeImpl, rangeImpl); }