Ultra Geile Studenten Benutzer Oberfläche (UGSBO)
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.

48 lines
1.3 KiB

  1. package com.ugsbo.matrixcalc;
  2. import static org.junit.Assert.assertTrue;
  3. import org.junit.Test;
  4. /**
  5. * Tests how well worng input can be determent.
  6. */
  7. public class MatrixInputcheckTest {
  8. @Test(expected = IllegalArgumentException.class)
  9. public void inputEmptySouldThrowAIllegalArgumentException() {
  10. MatrixCalcController contr = new MatrixCalcController();
  11. String input = "";
  12. contr.checkInput(input);
  13. }
  14. @Test
  15. public void checkIfA1by3MatrixIsMatched(){
  16. MatrixCalcController contr = new MatrixCalcController();
  17. String input = "1 2 3";
  18. boolean result = contr.checkInput(input);
  19. assertTrue("The 1 by 3 Matrix was not Matched but it should be.", result);
  20. }
  21. @Test
  22. public void checkIfA2by3MatrixIsMatched(){
  23. MatrixCalcController contr = new MatrixCalcController();
  24. String input = "1 2 3\n1 2 3";
  25. boolean result = contr.checkInput(input);
  26. assertTrue("The 2 by 3 Matrix was not Matched but it should be.", result);
  27. }
  28. @Test
  29. public void checkIfA3by3MatrixIsMatched(){
  30. MatrixCalcController contr = new MatrixCalcController();
  31. String input = "1 2 3\n1 2 3\n1 2 3";
  32. boolean result = contr.checkInput(input);
  33. assertTrue("The 3 by 3 Matrix was not Matched but it should be.", result);
  34. }
  35. }