|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testValidEquilateralTriangle() { |
|
|
|
|
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
float a = 3; |
|
|
|
|
|
float b = 3; |
|
|
|
|
|
float c = 3; |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testValidNoTriangle1() { |
|
|
|
|
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
float a = 0; |
|
|
|
|
|
float b = 1; |
|
|
|
|
|
float c = 0; |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, type); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
public void testValidNoTriangle2() { |
|
|
|
|
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
float a = 2; |
|
|
|
|
|
float b = 1; |
|
|
|
|
|
float c = -2; |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, type); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
@Test |
|
|
|
|
|
public void testValidNoTriangle3() { |
|
|
|
|
|
|
|
|
|
|
|
// Arrange |
|
|
|
|
|
float a = 1; |
|
|
|
|
|
float b = 2; |
|
|
|
|
|
float c = 13; |
|
|
|
|
|
|
|
|
|
|
|
// Act |
|
|
|
|
|
TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c); |
|
|
|
|
|
|
|
|
|
|
|
// Assert |
|
|
|
|
|
assertEquals(TriangleChecker.TriangleType.NONE, type); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |