@@ -47,6 +47,13 @@ public class TriangleChecker { | |||
// Analyse der Dreiecksart | |||
public static TriangleType checkTriangle(float a, float b, float c) { | |||
if( (a+b>c) && (c+b>a) && (a+c>b)) { | |||
if(a==b && b==c && a==c) return TriangleType.ISOSCELES; | |||
return TriangleType.NORMAL; | |||
} | |||
return TriangleType.NONE; | |||
} | |||
@@ -16,7 +16,22 @@ public class TriangleCheckerTest { | |||
// Assert | |||
assertEquals(TriangleChecker.TriangleType.NORMAL, type); | |||
} | |||
@Test | |||
public void testEqualTriangle(){ | |||
// Arrange | |||
float a = 3; | |||
float b = 3; | |||
float c = 3; | |||
// Act | |||
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); | |||
// Assert | |||
assertEquals(TriangleChecker.TriangleType.ISOSCELES, type); | |||
} | |||
} |