Newer
Older
import java.util.ArrayList;
import java.util.List;
public class TestCohort {
public static void main(String[] args){
TestCohort test = new TestCohort();
if (test.testGetStudents() == true)
System.out.println("testGetStudents = correct");
else
System.out.println("testGetStudents = incorrect");
if (test.testToString() == true)
System.out.println("testToString = correct");
else
System.out.println("testToString = incorrect");
}
public boolean testGetStudents(){
List<Student> testStudents = new ArrayList<>();
Cohort testCohort = new Cohort("Programmation");
testStudents.add(new Student("Leo", "Rangheard"));
testStudents.add(new Student("Ahmed", "Souissi"));
testCohort.addStudent(new Student("Leo", "Rangheard"));
testCohort.addStudent(new Student("Ahmed", "Souissi"));
if (testCohort.getStudents().equals(testStudents))
return true;
else
return false;
}
public boolean testToString(){
Cohort testCohort = new Cohort("Programmation");
if (testCohort.toString().equals("Programmation"))
return true;
else
return false;
}
}