### Question:
YWithXInterval implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof YWithXInterval)) { return false; } YWithXInterval that = (YWithXInterval) obj; if (this.y != that.y) { return false; } if (this.xLow != that.xLow) { return false; } if (this.xHigh != that.xHigh) { return false; } return true; } YWithXInterval(double y, double xLow, double xHigh); double getY(); double getXLow(); double getXHigh(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testEquals() { YWithXInterval i1 = new YWithXInterval(1.0, 0.5, 1.5); YWithXInterval i2 = new YWithXInterval(1.0, 0.5, 1.5); assertEquals(i1, i2); i1 = new YWithXInterval(1.1, 0.5, 1.5); assertFalse(i1.equals(i2)); i2 = new YWithXInterval(1.1, 0.5, 1.5); assertEquals(i1, i2); i1 = new YWithXInterval(1.1, 0.55, 1.5); assertFalse(i1.equals(i2)); i2 = new YWithXInterval(1.1, 0.55, 1.5); assertEquals(i1, i2); i1 = new YWithXInterval(1.1, 0.55, 1.55); assertFalse(i1.equals(i2)); i2 = new YWithXInterval(1.1, 0.55, 1.55); assertEquals(i1, i2); }