-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v9-migration' into v9-migration-GetSessionResultsAction
- Loading branch information
Showing
29 changed files
with
1,321 additions
and
104 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
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 |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
|
||
import java.time.Duration; | ||
import java.time.Instant; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
|
@@ -42,6 +45,52 @@ public void testGetFeedbackSessionByFeedbackSessionNameAndCourseId() | |
verifyEquals(fs2, actualFs); | ||
} | ||
|
||
@Test | ||
public void testGetOngoingSessions_typicalCase_shouldGetOnlyOngoingSessionsWithinRange() | ||
throws EntityAlreadyExistsException, InvalidParametersException { | ||
Instant instantNow = Instant.now(); | ||
Course course1 = new Course("test-id1", "test-name1", "UTC", "NUS"); | ||
coursesDb.createCourse(course1); | ||
FeedbackSession c1Fs1 = new FeedbackSession("name1-1", course1, "[email protected]", "test-instruction", | ||
instantNow.minus(Duration.ofDays(7L)), instantNow.minus(Duration.ofDays(1L)), | ||
instantNow.minus(Duration.ofDays(7L)), instantNow.plus(Duration.ofDays(7L)), Duration.ofMinutes(10L), | ||
true, true, true); | ||
fsDb.createFeedbackSession(c1Fs1); | ||
FeedbackSession c1Fs2 = new FeedbackSession("name1-2", course1, "[email protected]", "test-instruction", | ||
instantNow, instantNow.plus(Duration.ofDays(7L)), | ||
instantNow.minus(Duration.ofDays(7L)), instantNow.plus(Duration.ofDays(7L)), Duration.ofMinutes(10L), | ||
true, true, true); | ||
fsDb.createFeedbackSession(c1Fs2); | ||
Course course2 = new Course("test-id2", "test-name2", "UTC", "MIT"); | ||
coursesDb.createCourse(course2); | ||
FeedbackSession c2Fs1 = new FeedbackSession("name2-1", course2, "[email protected]", "test-instruction", | ||
instantNow.minus(Duration.ofHours(12L)), instantNow.plus(Duration.ofHours(12L)), | ||
instantNow.minus(Duration.ofDays(7L)), instantNow.plus(Duration.ofDays(7L)), Duration.ofMinutes(10L), | ||
true, true, true); | ||
fsDb.createFeedbackSession(c2Fs1); | ||
FeedbackSession c2Fs2 = new FeedbackSession("name2-2", course2, "[email protected]", "test-instruction", | ||
instantNow.plus(Duration.ofDays(1L)), instantNow.plus(Duration.ofDays(7L)), | ||
instantNow.minus(Duration.ofDays(7L)), instantNow.plus(Duration.ofDays(7L)), Duration.ofMinutes(10L), | ||
true, true, true); | ||
fsDb.createFeedbackSession(c2Fs2); | ||
Course course3 = new Course("test-id3", "test-name3", "UTC", "UCL"); | ||
coursesDb.createCourse(course3); | ||
FeedbackSession c3Fs1 = new FeedbackSession("name3-1", course3, "[email protected]", "test-instruction", | ||
instantNow.minus(Duration.ofDays(7L)), instantNow, | ||
instantNow.minus(Duration.ofDays(7L)), instantNow.plus(Duration.ofDays(7L)), Duration.ofMinutes(10L), | ||
true, true, true); | ||
fsDb.createFeedbackSession(c3Fs1); | ||
Set<FeedbackSession> expectedUniqueOngoingSessions = new HashSet<>(); | ||
expectedUniqueOngoingSessions.add(c1Fs2); | ||
expectedUniqueOngoingSessions.add(c2Fs1); | ||
expectedUniqueOngoingSessions.add(c3Fs1); | ||
List<FeedbackSession> actualOngoingSessions = | ||
fsDb.getOngoingSessions(instantNow.minus(Duration.ofDays(1L)), instantNow.plus(Duration.ofDays(1L))); | ||
Set<FeedbackSession> actualUniqueOngoingSessions = new HashSet<>(); | ||
actualUniqueOngoingSessions.addAll(actualOngoingSessions); | ||
assertEquals(expectedUniqueOngoingSessions, actualUniqueOngoingSessions); | ||
} | ||
|
||
@Test | ||
public void testSoftDeleteFeedbackSession() | ||
throws EntityAlreadyExistsException, InvalidParametersException, EntityDoesNotExistException { | ||
|
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
Oops, something went wrong.