|
|
@@ -2,14 +2,14 @@ import org.junit.Test; |
|
|
|
import static org.junit.Assert.*; |
|
|
|
|
|
|
|
public class TriangleCheckerTest { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
public void testValidTriangle() { |
|
|
|
public void testIsTriangle() { |
|
|
|
|
|
|
|
// Arrange |
|
|
|
float a = 7; |
|
|
|
float b = 3; |
|
|
|
float c = 1; |
|
|
|
float a = 3; |
|
|
|
float b = 2; |
|
|
|
float c = 4; |
|
|
|
|
|
|
|
// Act |
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
@@ -17,6 +17,55 @@ public class TriangleCheckerTest { |
|
|
|
// Assert |
|
|
|
assertEquals(TriangleChecker.TriangleType.NORMAL, type); |
|
|
|
|
|
|
|
// Arrange |
|
|
|
a = -2; |
|
|
|
b = 5; |
|
|
|
c = 2; |
|
|
|
|
|
|
|
// Act |
|
|
|
type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
// Assert |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, type); |
|
|
|
|
|
|
|
// Arrange |
|
|
|
a = 5; |
|
|
|
b = 5; |
|
|
|
c = 10; |
|
|
|
|
|
|
|
// Act |
|
|
|
type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
// Assert |
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, type); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void testIsoTriangle(){ |
|
|
|
// Arrange |
|
|
|
float a = 6; |
|
|
|
float b = 6; |
|
|
|
float c = 3; |
|
|
|
|
|
|
|
// Act |
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
// Assert |
|
|
|
assertEquals(TriangleChecker.TriangleType.ISOSCELES, type); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
public void testEqualTriangle(){ |
|
|
|
// Arrange |
|
|
|
float a = 5; |
|
|
|
float b = 5; |
|
|
|
float c = 5; |
|
|
|
|
|
|
|
// Act |
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
// Assert |
|
|
|
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |