Browse Source

Merge changes in AdministrationTest

remotes/origin/fdai7780
fdai7887 11 months ago
parent
commit
fdbe102bcc
  1. 40
      src/test/java/org/example/AdministrationTest.java

40
src/test/java/org/example/AdministrationTest.java

@ -20,6 +20,46 @@ class AdministrationTest {
}
@Test
void isNumber() {
Administration administration = new Administration();
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(full01);
boolean test02 = administration.isNumber(full02);
boolean test03 = administration.isNumber(full03);
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
}
@Test
void rightPrefix() {
Administration administration = new Administration();
String full01 = "S1002"; //Supposed Student id
String full02 = "s100Z"; //Supposed Student id
String full03 = "X1004"; // Supposed Professor id
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);
assertEquals(false, test03);
}
@org.junit.jupiter.api.Test
void findStudentById(){

Loading…
Cancel
Save