|
|
@ -25,21 +25,21 @@ class AdministrationTest { |
|
|
|
void isNumber() { |
|
|
|
|
|
|
|
Administration administration = new Administration(); |
|
|
|
String full01 = "S1002"; |
|
|
|
String str1 = full01.substring(1); |
|
|
|
String full02 = "S100Z"; |
|
|
|
String str2 = full02.substring(1); |
|
|
|
String full03 = "P1004"; |
|
|
|
String str3 = full03.substring(1); |
|
|
|
|
|
|
|
|
|
|
|
String full01 = "S1002"; //Supposed student id |
|
|
|
String str1 = full01.substring(1); //String without the Letter |
|
|
|
String full02 = "S100Z"; //Supposed student id |
|
|
|
String str2 = full02.substring(1); //String without the Letter |
|
|
|
String full03 = "P1004"; //Supposed professor id |
|
|
|
String str3 = full03.substring(1); //String without the Letter |
|
|
|
|
|
|
|
//checks if the substrings contain only digits |
|
|
|
boolean test01 = administration.isNumber(str1); |
|
|
|
boolean test02 = administration.isNumber(str2); |
|
|
|
boolean test03 = administration.isNumber(str3); |
|
|
|
|
|
|
|
assertEquals(true, test01); |
|
|
|
assertEquals(false, test02); |
|
|
|
assertEquals(true, test03); |
|
|
|
assertEquals(true, test01); //only digits besides the first letter |
|
|
|
assertEquals(false, test02); // false, because the Z at the end |
|
|
|
assertEquals(true, test03); //only digits besides the first letter |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -47,14 +47,14 @@ class AdministrationTest { |
|
|
|
void rightPrefix() { |
|
|
|
Administration administration = new Administration(); |
|
|
|
|
|
|
|
String full01 = "S1002"; |
|
|
|
String full02 = "s100Z"; |
|
|
|
String full03 = "X1004"; |
|
|
|
String full01 = "S1002"; //Supposed Student id |
|
|
|
String full02 = "s100Z"; //Supposed Student id |
|
|
|
String full03 = "X1004"; // Supposed Professor id |
|
|
|
|
|
|
|
|
|
|
|
boolean test01 = administration.rightPrefix(full01, 1); |
|
|
|
boolean test02 = administration.rightPrefix(full02, 1); |
|
|
|
boolean test03 = administration.rightPrefix(full03, 3); |
|
|
|
boolean test01 = administration.rightPrefix(full01, 1); //checks if the id is correct, "1" because we are expecting a student id |
|
|
|
boolean test02 = administration.rightPrefix(full02, 1); //checks if the id is correct, "1" because we are expecting a student id |
|
|
|
boolean test03 = administration.rightPrefix(full03, 3); //checks if the id is correct, "3" because we are expecting a professor id |
|
|
|
|
|
|
|
assertEquals(true, test01); |
|
|
|
assertEquals(false, test02); |
|
|
|