@@ -49,17 +49,15 @@ public class TriangleChecker { | |||
public static TriangleType checkTriangle(float a, float b, float c) { | |||
if(a >= (b+c) || c >= (b+a) || b >= (a+c) || a<=0 || b<=0 || c<=0){ | |||
return TriangleType.NONE; | |||
} | |||
if(a == b && b==c) { | |||
return TriangleType.EQUILATERAL; | |||
} | |||
if(a == b || a == c || b == c){ | |||
return TriangleType.ISOSCELES; | |||
} | |||
return TriangleType.NORMAL; | |||
} | |||
} |
@@ -54,4 +54,22 @@ public class TriangleCheckerTest { | |||
} | |||
@Test | |||
public void testISOSCELESTriangle() { | |||
// Arrange | |||
float a = 3; | |||
float b = 2; | |||
float c = 2; | |||
// Act | |||
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); | |||
// Assert | |||
assertEquals(TriangleChecker.TriangleType.ISOSCELES, type); | |||
} | |||
} |