|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- import org.junit.Test;
- import static org.junit.Assert.*;
-
- public class TriangleCheckerTest {
-
- @Test
- public void testValidTriangle() {
-
- // Arrange
- float a = 2;
- float b = 3;
- float c = 4;
-
- // Act
- TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
-
- // Assert
- assertEquals(TriangleChecker.TriangleType.NORMAL, type);
-
- }
-
- @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);
-
- }
-
- @Test
- public void testValidNoTriangle4() {
-
- // Arrange
- float a = -1;
- float b = -1;
- float c = -1;
-
- // Act
- TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
-
- // Assert
- assertEquals(TriangleChecker.TriangleType.NONE, type);
-
- }
-
- @Test
- public void testValidNoTriangle5() {
-
- // Arrange
- float a = 4;
- float b = 4;
- float c = 13;
-
- // Act
- TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
-
- // Assert
- assertEquals(TriangleChecker.TriangleType.NONE, type);
-
- }
-
- @Test
- public void testValidNoTriangle6() {
-
- // Arrange
- float a = 3;
- float b = 5;
- float c = 8;
-
- // Act
- TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
-
- // Assert
- assertEquals(TriangleChecker.TriangleType.NONE, type);
-
- }
-
- @Test
- public void testValidIsoscelesTriangle() {
-
- // Arrange
- float a = 3;
- float b = 3;
- float c = 4;
-
- // Act
- TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
-
- // Assert
- assertEquals(TriangleChecker.TriangleType.ISOSCELES, type);
-
- }
-
-
- }
|