Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
Lab 6
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731087
Lab 6
Commits
7de9be44
Commit
7de9be44
authored
Apr 14, 2019
by
9731087
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Last commit
parent
6789422a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
+19
-19
CourseTest.java
src/Test/CourseTest.java
+4
-3
DepartmentTest.java
src/Test/DepartmentTest.java
+6
-6
ProfessorTest.java
src/Test/ProfessorTest.java
+1
-4
UniversityTest.java
src/Test/UniversityTest.java
+3
-2
Course.java
src/com/university/Course.java
+5
-0
Professor.java
src/com/university/Professor.java
+0
-4
No files found.
src/Test/CourseTest.java
View file @
7de9be44
...
@@ -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
));
}
}
...
...
src/Test/DepartmentTest.java
View file @
7de9be44
...
@@ -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
);
assert
Equals
(
department
.
getCourses
(),
course
);
assert
NotNull
(
department
.
getCourses
()
);
assert
Equals
(
department
.
getProfessors
(),
professor
);
assert
NotNull
(
department
.
getProfessors
()
);
assert
Equals
(
department
.
getStudents
(),
student
);
assert
NotNull
(
department
.
getStudents
()
);
}
}
...
...
src/Test/ProfessorTest.java
View file @
7de9be44
...
@@ -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
());
}
}
...
...
src/Test/UniversityTest.java
View file @
7de9be44
...
@@ -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
src/com/university/Course.java
View file @
7de9be44
...
@@ -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
(){
...
...
src/com/university/Professor.java
View file @
7de9be44
...
@@ -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
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment