Plane { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } Plane that = (Plane) o; return this.normal.equals(that.normal) && this.distance == that.distance; } Plane();  Plane(double x, double y, double z, double distance);  Plane(Plane plane); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); double distanceToPoint(Vec3 point); Plane set(double x, double y, double z, double distance); Plane set(Plane plane); Plane transformByMatrix(Matrix4 matrix); double dot(Vec3 vector); boolean intersectsSegment(Vec3 endPoint1, Vec3 endPoint2); int onSameSide(Vec3 pointA, Vec3 pointB); Vec3[] clip(Vec3 pointA, Vec3 pointB);  }
@Test public void testEquals() throws Exception { Vec3 n = new Vec3(3, 4, 5).normalize(); double distance = 6; Plane plane1 = new Plane(n.x, n.y, n.z, distance); Plane plane2 = new Plane(n.x, n.y, n.z, distance); assertEquals("normal", plane1.normal, plane2.normal); assertEquals("distance", plane1.distance, plane2.distance, 0); assertTrue("equals", plane1.equals(plane2)); }
@Test public void testEquals_Inequality() throws Exception { Vec3 n = new Vec3(3, 4, 5).normalize(); double distance1 = 6; double distance2 = 7; Plane plane1 = new Plane(n.x, n.y, n.z, distance1); Plane plane2 = new Plane(n.x, n.y, n.z, distance2); Plane plane3 = new Plane(0, 1, 0, distance1); assertFalse("not equals", plane1.equals(plane2)); assertFalse("not equals", plane1.equals(plane3)); }
@SuppressWarnings("ObjectEqualsNull") @Test public void testEquals_Null() throws Exception { Vec3 n = new Vec3(3, 4, 5).normalize(); double distance = 10; Plane plane1 = new Plane(n.x, n.y, n.z, distance); boolean result = plane1.equals(null); assertFalse("not equals", result); }