Skip to content
Snippets Groups Projects
TestCohort.java 1.24 KiB
Newer Older
  • Learn to ignore specific revisions
  • 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;
        }
    }