Browse Source

Test2 NONE

master
Moritz Neumeier 3 years ago
parent
commit
2ddb098ac7

BIN
out/production/TriangleCheckerAssignment/TriangleChecker.class View File


BIN
out/test/TriangleCheckerAssignment/TriangleCheckerTest.class View File


+ 1
- 1
src/TriangleChecker.java View File

@@ -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;
}

+ 17
- 0
test/TriangleCheckerTest.java View File

@@ -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);


}

}

Loading…
Cancel
Save