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.

49 lines
1.3 KiB

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);
}
}