-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added CourseMap entity, started unit tests, fixed use case files
- Loading branch information
Showing
9 changed files
with
150 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package Entities; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
|
||
/** | ||
* A map of courseID to the Course | ||
*/ | ||
|
||
public class CourseMap implements Serializable { | ||
private static HashMap<String, Course> courseMap; | ||
|
||
/** | ||
* Find a course using its unique ID | ||
* @param id the unique ID of the course | ||
* @return the Course object associated with the ID | ||
*/ | ||
public Course findCourse(String id) { | ||
return courseMap.get(id); | ||
} | ||
|
||
/** | ||
* @param id the unique ID of the Course object | ||
* @param course the course associated with Course | ||
* @return if the course has been added | ||
*/ | ||
public boolean addCourse(String id, Course course) { | ||
if (courseMap.containsKey(id)) { | ||
return false; | ||
} | ||
courseMap.put(id, course); | ||
return true; | ||
} | ||
|
||
public void save() { | ||
|
||
} | ||
|
||
public void load() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
test/course_creation_use_case/CourseCreationInteractorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package course_creation_use_case; | ||
|
||
public class CourseCreationInteractorTest { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package entities; | ||
|
||
//import org.junit.jupiter.api.Test; | ||
// | ||
//import static org.junit.jupiter.api.Assertions.assertFalse; | ||
// | ||
//public class CourseUnitTest { | ||
// | ||
// @Test | ||
// void givenCourse_whenCourseExists_thenIsFalse() { | ||
// Course course = new Course("csc207", "paulgries", "tasks idk"); | ||
// | ||
// assertFalse(course.courseExists); | ||
// } | ||
//} |