Lukas Reichwein
5 years ago
2 changed files with 84 additions and 5 deletions
-
32src/main/java/com/ugsbo/matrixcalc/MatrixCalcController.java
-
49src/test/java/com/ugsbo/matrixcalc/MatrixInputcheckTest.java
@ -0,0 +1,49 @@ |
|||||
|
package com.ugsbo.matrixcalc; |
||||
|
|
||||
|
import static org.junit.Assert.assertTrue; |
||||
|
|
||||
|
import org.junit.Test; |
||||
|
|
||||
|
/** |
||||
|
* Tests how well worng input can be determent. |
||||
|
*/ |
||||
|
public class MatrixInputcheckTest { |
||||
|
|
||||
|
@Test(expected = IllegalArgumentException.class) |
||||
|
public void inputEmptySouldThrowAIllegalArgumentException() { |
||||
|
MatrixCalcController contr = new MatrixCalcController(); |
||||
|
String input = ""; |
||||
|
|
||||
|
contr.checkInput(input); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void checkIfA1by3MatrixIsMatched(){ |
||||
|
MatrixCalcController contr = new MatrixCalcController(); |
||||
|
String input = "1 2 3"; |
||||
|
|
||||
|
boolean result = contr.checkInput(input); |
||||
|
|
||||
|
assertTrue("The 1 by 3 Matrix was not Matched but it should be.", result); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void checkIfA2by3MatrixIsMatched(){ |
||||
|
MatrixCalcController contr = new MatrixCalcController(); |
||||
|
String input = "1 2 3\n1 2 3"; |
||||
|
|
||||
|
boolean result = contr.checkInput(input); |
||||
|
|
||||
|
assertTrue("The 2 by 3 Matrix was not Matched but it should be.", result); |
||||
|
} |
||||
|
|
||||
|
@Test |
||||
|
public void checkIfA3by3MatrixIsMatched(){ |
||||
|
MatrixCalcController contr = new MatrixCalcController(); |
||||
|
String input = "1 2 3\n1 2 3\n1 2 3"; |
||||
|
|
||||
|
boolean result = contr.checkInput(input); |
||||
|
|
||||
|
assertTrue("The 3 by 3 Matrix was not Matched but it should be.", result); |
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue