diff --git a/src/test/java/fr/nancy/iut/SphereTest.java b/src/test/java/fr/nancy/iut/SphereTest.java index 3342054ac699a26c257d69cc68bfd4f68d3db2c9..a86fef8a777d260846547ce86083b77c3ccbf1f9 100644 --- a/src/test/java/fr/nancy/iut/SphereTest.java +++ b/src/test/java/fr/nancy/iut/SphereTest.java @@ -1,6 +1,8 @@ package fr.nancy.iut; import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import javax.vecmath.Point3d; @@ -8,10 +10,49 @@ import javax.vecmath.Point3d; * Created by dparsons on 12/08/15. */ public class SphereTest { + + private Sphere sphere, sphere1; + + @BeforeEach + public void before() + { + this.sphere = new Sphere(1.5); + this.sphere1 = new Sphere(2); + } + @Test public void testComputeVolume() throws Exception { - Sphere mySphere = new Sphere(1.5); - assertEquals(14.137166941154069, mySphere.computeVolume(), 0.0); + assertEquals(14.137166941154069, sphere.computeVolume(), 0.0); + } + + @Test + public void testDistanceTo() + { + assertEquals(0, sphere.distanceTo(sphere1), 0.0); + } + + @Test + public void testDistanceSquaredTo() + { + assertEquals(0, sphere.distanceTo(sphere1), 0.0); + } + + @Test + public void testContact() + { + assertEquals(true, sphere.distanceTo(sphere1)); + } + + @Test + public void testConstructeur() + { + Sphere sp = new Sphere(0.5); + assertEquals(0.5, sp.radius_); + assertEquals(0, sp.pos_.x); + assertEquals(0, sp.pos_.y); + assertEquals(0, sp.pos_.z); + + } } \ No newline at end of file