Praktikum 4
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TriangleCheckerTest.java 1.0KB

2 years ago
2 years ago
2 years ago
2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import org.junit.Test;
  2. import static org.junit.Assert.*;
  3. public class TriangleCheckerTest {
  4. @Test
  5. public void testValidTriangle() {
  6. // Arrange
  7. float a = 2;
  8. float b = 3;
  9. float c = 4;
  10. // Act
  11. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
  12. // Assert
  13. assertEquals(TriangleChecker.TriangleType.NORMAL, type);
  14. }
  15. @Test
  16. public void testIsoTriangle(){
  17. // Arrange
  18. float a = 3;
  19. float b = 3;
  20. float c = 2;
  21. // Act
  22. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
  23. // Assert
  24. assertEquals(TriangleChecker.TriangleType.ISOSCELES, type);
  25. }
  26. @Test
  27. public void testEqualTriangle(){
  28. // Arrange
  29. float a = 3;
  30. float b = 3;
  31. float c = 3;
  32. // Act
  33. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a, b, c);
  34. // Assert
  35. assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type);
  36. }
  37. }