Commit 7de9be44 authored by 9731087's avatar 9731087

Last commit

parent 6789422a
......@@ -22,7 +22,7 @@ class CourseTest {
student = new Student("Amir", "87", "am", department);
professor = new Professor(department, "mmd");
course = new Course("1", "az", department, professor, 100);
course.enrollStudent(student);
}
@Test
......@@ -31,10 +31,11 @@ class CourseTest {
assertEquals("az", course.getName());
assertEquals("1", course.getID());
assertEquals("100", course.getCredit());
assertEquals(100, course.getCredit());
assertEquals(department, course.getDepartment());
assertEquals(professor, course.getProfessor());
assertEquals(student, course.getStudents());
assertNotNull(course.getStudents());
assertEquals(student, course.getStudents().get(0));
}
......
......@@ -33,16 +33,16 @@ class DepartmentTest {
public void testDepartment(){
assertEquals(department.getCourses(), course);
assertEquals(department.getProfessors(),professor);
assertEquals(department.getStudents(), student);
assertEquals(department.getCourses().get(0), course);
assertEquals(department.getProfessors().get(0),professor);
assertEquals(department.getStudents().get(0), student);
assertEquals("ce",department.getName());
department.removeCourse(course);
department.removeProfessor(professor);
department.removeStudent(student);
assertEquals(department.getCourses(), course);
assertEquals(department.getProfessors(),professor);
assertEquals(department.getStudents(), student);
assertNotNull(department.getCourses());
assertNotNull(department.getProfessors());
assertNotNull(department.getStudents());
}
......
......@@ -24,9 +24,7 @@ class ProfessorTest {
student = new Student("Amir", "87", "am", department);
professor = new Professor(department, "mmd");
course = new Course("1", "az", department, professor, 100);
// department.addCourse(course);
// department.addProfessor(professor);
// department.addStudent(student);
}
@Test
......@@ -35,7 +33,6 @@ class ProfessorTest {
assertEquals("mmd", professor.getName());
assertEquals(department, professor.getDepartment());
assertEquals(course, department.getCourses());
}
......
......@@ -34,9 +34,10 @@ class UniversityTest {
public void testProfessor() {
assertEquals(department, university.getDepartments());
assertEquals(department, university.getDepartments().get(0));
university.removeDepartment(department);
assertEquals(department, university.getDepartments());
assertNotNull(department);
}
}
\ No newline at end of file
......@@ -13,6 +13,11 @@ public class Course {
public Course(String ID, String name, Department department, Professor professor, int credit) {
this.id = ID;
this.name = name;
this.department = department;
this.professor = professor;
this.credit = credit;
}
public String getID(){
......
......@@ -6,7 +6,6 @@ public class Professor {
Department department;
String name;
ArrayList<Course> courses = new ArrayList<>();
public Professor(Department department, String name) {
this.department = department;
......@@ -21,7 +20,4 @@ public class Professor {
return this.name;
}
public ArrayList<Course> getCourses() {
return this.courses;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment