-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourseTest.java
More file actions
36 lines (29 loc) · 1.25 KB
/
CourseTest.java
File metadata and controls
36 lines (29 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import org.junit.Test;
import java.util.ArrayList;
import java.util.Date;
import static org.junit.Assert.*;
public class CourseTest {
@Test
public void testCourseHashCodeWithUuid101() throws Exception {
final Course testCourse = new Course("101", "101", new ArrayList());
final int code = '1' + '0' + '1';
assertEquals("Course with the uuid 101 returns incorrect hashCode", code, testCourse.hashCode());
}
@Test
public void testCourseHashCodeWithUuidNull() throws Exception {
final Course testCourse = new Course(null, "101", new ArrayList());
assertEquals("Course with the uuid null returns incorrect hashCode", 0, testCourse.hashCode());
}
@Test
public void testCourseHashCodeWithEmptyUuid() throws Exception {
final Course testCourse = new Course("", "101", new ArrayList());
assertEquals("Course with the uuid null returns incorrect hashCode", 0, testCourse.hashCode());
}
@Test
public void testSessionHashCode() throws Exception {
final Date testDate = new Date();
final Course testCourse = new Course("1l", "102", new ArrayList());
final Course.Session session = testCourse.new Session(testDate);
assertEquals(testDate.hashCode(), session.hashCode());
}
}