-> Test jetzt für alle Fälle positivmaster
@@ -48,7 +48,7 @@ public class TriangleChecker { | |||
// Analyse der Dreiecksart | |||
public static TriangleType checkTriangle(float a, float b, float c) { | |||
if (a+b>c || b+c>a || a+c>b) { | |||
if ((a+b>c || b+c>a || a+c>b) && (a>0 && b>0 && c>0)) { | |||
if (a==b && b==c) { | |||
return TriangleType.EQUILATERAL; |
@@ -7,15 +7,15 @@ public class TriangleCheckerTest { | |||
public void testValidTriangle() { | |||
// Arrange | |||
float a = 2; | |||
float b = 2; | |||
float a = 0; | |||
float b = 0; | |||
float c = 2; | |||
// Act | |||
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); | |||
// Assert | |||
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type); | |||
assertEquals(TriangleChecker.TriangleType.NONE, type); | |||
} | |||