예제 #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());
 }
예제 #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());
 }
예제 #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());
 }
예제 #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());
 }