Triangle { public String getClassification() { String result = "isosceles"; if (s1 <= 0 || s2 <= 0 || s3 <= 0) { result = "not a triangle"; } else if ((s1 >= s2 + s3) || (s2 >= s1 + s3) || (s3 >= s1 + s2)) { result = "not a triangle"; } else if ((s1 == s2) && (s2 == s3)) { result = "equilateral"; } else if ((s1 != s2) && (s1 != s3) && (s2 != s3)) { result = "scalene"; } return result; } Triangle(double side1, double side2, double side3); double getS1(); double getS2(); double getS3(); String getClassification(); double perimeter(); boolean equals(Object o); int hashCode(); String toString();  }
@Test public void getClassificationScaleneTest() { Triangle t = new Triangle(3, 4, 5); Assert.assertEquals("getClassification scalene test", "scalene", t.getClassification()); }
@Test public void getClassificationIsoscelesTest() { Triangle t = new Triangle(7, 10, 7); Assert.assertEquals("getClassification isosceles test", "isosceles", t.getClassification()); t = new Triangle(7, 7, 9); Assert.assertEquals("getClassification isosceles test", "isosceles", t.getClassification()); t = new Triangle(9, 7, 7); Assert.assertEquals("getClassification isosceles test", "isosceles", t.getClassification()); }
@Test public void getClassificationEquilateralTest() { Triangle t = new Triangle(7, 7, 7); Assert.assertEquals("getClassification test", "equilateral", t.getClassification()); }
@Test public void getClassificationNotATriangleTest() { Triangle t = new Triangle(0, 7, 7); Assert.assertEquals("getClassification test", "not a triangle", t.getClassification()); t = new Triangle(7, 0, 7); Assert.assertEquals("getClassification test", "not a triangle", t.getClassification()); t = new Triangle(7, 7, 0); Assert.assertEquals("getClassification test", "not a triangle", t.getClassification()); t = new Triangle(15, 7, 7); Assert.assertEquals("getClassification test", "not a triangle", t.getClassification()); t = new Triangle(7, 15, 7); Assert.assertEquals("getClassification test", "not a triangle", t.getClassification()); t = new Triangle(7, 7, 15); Assert.assertEquals("getClassification test", "not a triangle", t.getClassification()); }