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.

52 lines
1.3 KiB

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