-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathCourseServiceTest.java
More file actions
33 lines (28 loc) · 1.07 KB
/
CourseServiceTest.java
File metadata and controls
33 lines (28 loc) · 1.07 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
package com.generation.service;
import com.generation.model.Course;
import com.generation.model.Module;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class CourseServiceTest {
// import object from CourseService
public CourseService courseService;
// before each test implement this constructor
@BeforeEach
void setUp() {
courseService = new CourseService(); }
@Test
void getCourseNull() {
Course course = courseService.getCourse("Invalid Code");
assertNull(course);
}
@Test
void registerCourse() {
Module moduleWebFundamentals = new Module("INTRO-WEB", "Web Development Fundamentals",
"Introduction to fundamentals of web development" );
Course course = new Course("INTRO-WEB-7", "Introduction to JavaScript for Web Development", 9, moduleWebFundamentals );
courseService.registerCourse(course);
Course course1 = courseService.getCourse("INTRO-WEB-7");
assertEquals(course, course1);
}
}