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.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package Praktikum03;
  2. import org.junit.jupiter.api.Test;
  3. import static org.junit.jupiter.api.Assertions.*;
  4. class TriangleCheckerTest {
  5. @Test
  6. void checkNormalTriangle() {
  7. float a = 3.0f;
  8. float b = 4.0f;
  9. float c = 2.0f;
  10. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a,b,c);
  11. assertEquals(TriangleChecker.TriangleType.NORMAL, type);
  12. }
  13. @Test
  14. void checkEquilateralTriangle() {
  15. float a = 3.0f;
  16. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a,a,a);
  17. assertEquals(TriangleChecker.TriangleType.EQUILATERAL, type);
  18. }
  19. @Test
  20. void checkIsoscelesTriangle() {
  21. float a = 3.0f;
  22. float b = 4.0f;
  23. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a,b,a);
  24. assertEquals(TriangleChecker.TriangleType.ISOSCELES, type);
  25. }
  26. @Test
  27. void checkNumbersNegative(){
  28. float a = 5.0f;
  29. float b = -20.0f;
  30. float c = 4.0f;
  31. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a,b,c);
  32. assertEquals(TriangleChecker.TriangleType.NONE, type);
  33. }
  34. @Test
  35. void checkIfSideToLong(){
  36. float a = 3.0f;
  37. float b = 20.0f;
  38. float c = 5.0f;
  39. TriangleChecker.TriangleType type = TriangleChecker.checkTriangle(a,b,c);
  40. assertEquals(TriangleChecker.TriangleType.NONE, type);
  41. }
  42. }