@@ -48,7 +48,7 @@ public class TriangleChecker { | |||
// Analyse der Dreiecksart | |||
public static TriangleType checkTriangle(float a, float b, float c) { | |||
if(a >= (b+c) || c >= (b+a) || b >= (a+c) ){ | |||
if(a >= (b+c) || c >= (b+a) || b >= (a+c) || a<=0 || b<=0 || c<=0){ | |||
return TriangleType.NONE; | |||
} |
@@ -37,4 +37,21 @@ public class TriangleCheckerTest { | |||
} | |||
@Test | |||
public void testNoTriangle() { | |||
// Arrange | |||
float a = -1; | |||
float b = 2; | |||
float c = -1; | |||
// Act | |||
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); | |||
// Assert | |||
assertEquals(TriangleChecker.TriangleType.NONE, type); | |||
} | |||
} |