Commit 7de9be44 authored by 9731087's avatar 9731087

Last commit

parent 6789422a
...@@ -22,7 +22,7 @@ class CourseTest { ...@@ -22,7 +22,7 @@ class CourseTest {
student = new Student("Amir", "87", "am", department); student = new Student("Amir", "87", "am", department);
professor = new Professor(department, "mmd"); professor = new Professor(department, "mmd");
course = new Course("1", "az", department, professor, 100); course = new Course("1", "az", department, professor, 100);
course.enrollStudent(student);
} }
@Test @Test
...@@ -31,10 +31,11 @@ class CourseTest { ...@@ -31,10 +31,11 @@ class CourseTest {
assertEquals("az", course.getName()); assertEquals("az", course.getName());
assertEquals("1", course.getID()); assertEquals("1", course.getID());
assertEquals("100", course.getCredit()); assertEquals(100, course.getCredit());
assertEquals(department, course.getDepartment()); assertEquals(department, course.getDepartment());
assertEquals(professor, course.getProfessor()); assertEquals(professor, course.getProfessor());
assertEquals(student, course.getStudents()); assertNotNull(course.getStudents());
assertEquals(student, course.getStudents().get(0));
} }
......
...@@ -33,16 +33,16 @@ class DepartmentTest { ...@@ -33,16 +33,16 @@ class DepartmentTest {
public void testDepartment(){ public void testDepartment(){
assertEquals(department.getCourses(), course); assertEquals(department.getCourses().get(0), course);
assertEquals(department.getProfessors(),professor); assertEquals(department.getProfessors().get(0),professor);
assertEquals(department.getStudents(), student); assertEquals(department.getStudents().get(0), student);
assertEquals("ce",department.getName()); assertEquals("ce",department.getName());
department.removeCourse(course); department.removeCourse(course);
department.removeProfessor(professor); department.removeProfessor(professor);
department.removeStudent(student); department.removeStudent(student);
assertEquals(department.getCourses(), course); assertNotNull(department.getCourses());
assertEquals(department.getProfessors(),professor); assertNotNull(department.getProfessors());
assertEquals(department.getStudents(), student); assertNotNull(department.getStudents());
} }
......
...@@ -24,9 +24,7 @@ class ProfessorTest { ...@@ -24,9 +24,7 @@ class ProfessorTest {
student = new Student("Amir", "87", "am", department); student = new Student("Amir", "87", "am", department);
professor = new Professor(department, "mmd"); professor = new Professor(department, "mmd");
course = new Course("1", "az", department, professor, 100); course = new Course("1", "az", department, professor, 100);
// department.addCourse(course);
// department.addProfessor(professor);
// department.addStudent(student);
} }
@Test @Test
...@@ -35,7 +33,6 @@ class ProfessorTest { ...@@ -35,7 +33,6 @@ class ProfessorTest {
assertEquals("mmd", professor.getName()); assertEquals("mmd", professor.getName());
assertEquals(department, professor.getDepartment()); assertEquals(department, professor.getDepartment());
assertEquals(course, department.getCourses());
} }
......
...@@ -34,9 +34,10 @@ class UniversityTest { ...@@ -34,9 +34,10 @@ class UniversityTest {
public void testProfessor() { public void testProfessor() {
assertEquals(department, university.getDepartments()); assertEquals(department, university.getDepartments().get(0));
university.removeDepartment(department); university.removeDepartment(department);
assertEquals(department, university.getDepartments()); assertNotNull(department);
} }
} }
\ No newline at end of file
...@@ -13,6 +13,11 @@ public class Course { ...@@ -13,6 +13,11 @@ public class Course {
public Course(String ID, String name, Department department, Professor professor, int credit) { 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(){ public String getID(){
......
...@@ -6,7 +6,6 @@ public class Professor { ...@@ -6,7 +6,6 @@ public class Professor {
Department department; Department department;
String name; String name;
ArrayList<Course> courses = new ArrayList<>();
public Professor(Department department, String name) { public Professor(Department department, String name) {
this.department = department; this.department = department;
...@@ -21,7 +20,4 @@ public class Professor { ...@@ -21,7 +20,4 @@ public class Professor {
return this.name; 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