diff --git a/src/test/java/fr/nancy/iut/SphereTest.java b/src/test/java/fr/nancy/iut/SphereTest.java index 0164c5fb590708974125b61eb5beb543504b5a6b..648a0e76cd4a8ad57179049b0773f2e80baffc03 100644 --- a/src/test/java/fr/nancy/iut/SphereTest.java +++ b/src/test/java/fr/nancy/iut/SphereTest.java @@ -12,6 +12,7 @@ public class SphereTest { public void testComputeVolume() throws Exception { Sphere mySphere = new Sphere(1.5); assertEquals(9.42477796076938, mySphere.computeVolume(), 0.0); + } @Test @@ -19,6 +20,35 @@ public class SphereTest { Sphere mySphere = new Sphere(1, new Point3d(10, 15, 5)); Sphere mySphere2 = new Sphere(1,new Point3d(10, 15, 6)); assertEquals(1, mySphere.distanceSquaredTo(mySphere2)); + assertEquals(1, mySphere.distanceTo(mySphere2)); + } + + @Test + public void testContact() throws Exception { + Sphere mySphere = new Sphere(1, new Point3d(10, 15, 5)); + Sphere mySphere2 = new Sphere(1,new Point3d(10, 15, 6)); + Sphere mySphere3 = new Sphere(1,new Point3d(100, 15, 6)); + assertEquals(true, mySphere2.inContactWith(mySphere2) ); + assertEquals(false, mySphere2.inContactWith(mySphere3) ); + Sphere mySphere4 = new Sphere(1); + Sphere mySphere5 = new Sphere(1); + assertEquals(true, mySphere4.inContactWith(mySphere5)); } + @Test + public void testGetters() throws Exception { + Sphere mySphere = new Sphere(1, new Point3d(10, 15, 5)); + assertEquals(new Point3d(10, 15, 5), mySphere.getPos()); + assertEquals(1, mySphere.getRadius()); + } + + @Test + public void testCreerCercle() throws Exception { + Sphere s1 = new Sphere(); + assertEquals(0, s1.getRadius()); + assertEquals(new Point3d(), s1.getPos()); + } + + + } \ No newline at end of file