create test classe for the CSV classe

This commit is contained in:
JunkJumper 2019-09-19 13:55:43 +02:00
parent 491f5c7753
commit d622400ab8

View File

@ -0,0 +1,47 @@
package genCSV;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class TestCSV {
@Test
public void createNullCSV() {
//We check if a CSV object cannot be created !
CSV c = new CSV();
assertEquals(null, c.getStudentNumber());
assertEquals(.0, c.getGrade());
}
@Test
public void checkFalseStudentnumber() {
//We check if the student number is full composed of numeric digits !
String s = "056498a198";
assertEquals(false, CSV.checkStudentNumber(s));
}
@Test
public void checkStudentNumberTooShort() {
//We check if the student number is enought long !
String s = "";
assertEquals(false, CSV.checkStudentNumber(s));
}
@Test
public void checkStudentNumberTooLong() {
//We check if the student number is enought short !
String s = "012345678910111213141516";
assertEquals(false, CSV.checkStudentNumber(s));
}
@Test
public void checkCorrectStudentNumber() {
//We check if the student number is correct !
String s = "123456789";
assertEquals(true, CSV.checkStudentNumber(s));
}
}