tests Plane and Sphere
diff --git a/src/unittests/PlaneTests.java b/src/unittests/PlaneTests.java
new file mode 100644
index 0000000..ef13cdb
--- /dev/null
+++ b/src/unittests/PlaneTests.java
@@ -0,0 +1,29 @@
+/**
+ *
+ */
+package unittests;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import geometries.Plane;
+import primitives.*;
+
+/**
+ * @author Adiel
+ *
+ */
+public class PlaneTests {
+
+ /**
+ * Test method for {@link geometries.Plane#getNormal(primitives.Point3D)}.
+ */
+ @Test
+ public void testGetNormalPoint3D() {
+ Plane pl = new Plane(new Point3D(0, 0, 1), new Point3D(1, 0, 0), new Point3D(0, 1, 0));
+ double sqrt3 = Math.sqrt(1d / 3);
+ assertEquals("Bad normal to plane", new Vector(sqrt3, sqrt3, sqrt3), pl.getNormal(new Point3D(0, 0, 1)));
+ }
+
+}
diff --git a/src/unittests/SphereTests.java b/src/unittests/SphereTests.java
index 537a11e..3e5e833 100644
--- a/src/unittests/SphereTests.java
+++ b/src/unittests/SphereTests.java
@@ -4,9 +4,11 @@
package unittests;
import static org.junit.Assert.*;
-
import org.junit.Test;
+import geometries.Sphere;
+import primitives.*;
+
/**
* @author Adiel
*
@@ -18,7 +20,9 @@
*/
@Test
public void testGetNormal() {
- fail("Not yet implemented");
+ Sphere sp=new Sphere(new Point3D(0,0,1),5);
+ double sqrt3 = Math.sqrt(2);
+ assertEquals("Bad normal to sphere",new Vector(1/sqrt3,0,-1/sqrt3),sp.getNormal(new Point3D(1,0,0)));
}
}