Exemple #1
0
 @Test
 public void getAreaTest() {
   Point point1 = new Point(3.0, 3.2);
   Circle circle = new Circle(point1, 3.0);
   double area = Math.pow(circle.getRadius(), 2) * Math.PI;
   assertEquals(
       "failure - area didn't match",
       Math.pow(circle.getRadius(), 2) * Math.PI,
       area,
       circle.getArea());
 }
Exemple #2
0
 @Test
 public void getDiameterTest() {
   Point point1 = new Point(3.0, 3.2);
   Circle circle = new Circle(point1, 3.0);
   double diameter = circle.getRadius() * 2.0;
   assertEquals("failure - diameter didn't match", 6.0, diameter, circle.getDiameter());
 }
Exemple #3
0
 @Test
 public void getRadiusTest() {
   Point point1 = new Point(3.0, 3.2);
   Circle circle = new Circle(point1, 3.0);
   double radius = 3.0;
   assertEquals("failure - radii didn't match", 3.0, radius, circle.getRadius());
 }
Exemple #4
0
 @Test
 public void getCirfumferenceTest() {
   Point point1 = new Point(3.0, 3.2);
   Circle circle = new Circle(point1, 3.0);
   double circumference = 2 * 3.0 * Math.PI;
   assertEquals(
       "failure - circumference didn't match",
       circle.getRadius() * Math.PI * 2,
       circumference,
       circle.getCircumference());
 }