@Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        } else if (!(obj instanceof Rectangle)) {
            return false;
        }
        Rectangle other = (Rectangle) obj;
        if (Double.doubleToLongBits(this.left) != Double.doubleToLongBits(other.left)) {
            return false;
        } else if (Double.doubleToLongBits(this.top) != Double.doubleToLongBits(other.top)) {
            return false;
        } else if (Double.doubleToLongBits(this.right) != Double.doubleToLongBits(other.right)) {
            return false;
        } else if (Double.doubleToLongBits(this.bottom) != Double.doubleToLongBits(other.bottom)) {
            return false;
        }
        return true;
    }
@Test
    public void equalsTest() {
        Rectangle rectangle1 = create(1, 2, 3, 4);
        Rectangle rectangle2 = create(1, 2, 3, 4);
        Rectangle rectangle3 = create(3, 2, 3, 4);
        Rectangle rectangle4 = create(1, 4, 3, 4);
        Rectangle rectangle5 = create(1, 2, 1, 4);
        Rectangle rectangle6 = create(1, 2, 3, 2);

        TestUtils.equalsTest(rectangle1, rectangle2);

        TestUtils.notEqualsTest(rectangle1, rectangle3);
        TestUtils.notEqualsTest(rectangle1, rectangle4);
        TestUtils.notEqualsTest(rectangle1, rectangle5);
        TestUtils.notEqualsTest(rectangle1, rectangle6);
        TestUtils.notEqualsTest(rectangle1, new Object());
        TestUtils.notEqualsTest(rectangle1, null);
    }