use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsDbTest method testGetFeedbackSessionsPossiblyNeedingClosedEmail.
private void testGetFeedbackSessionsPossiblyNeedingClosedEmail() {
______TS("standard success case");
List<FeedbackSessionAttributes> fsaList = fsDb.getFeedbackSessionsPossiblyNeedingClosedEmail();
assertEquals(7, fsaList.size());
for (FeedbackSessionAttributes fsa : fsaList) {
assertFalse(fsa.isSentClosedEmail());
assertTrue(fsa.isClosingEmailEnabled());
}
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsDbTest method testGetFeedbackSessions.
private void testGetFeedbackSessions() {
______TS("standard success case");
FeedbackSessionAttributes expected = dataBundle.feedbackSessions.get("session1InCourse2");
FeedbackSessionAttributes actual = fsDb.getFeedbackSession("idOfTypicalCourse2", "Private feedback session");
assertEquals(expected.toString(), actual.toString());
______TS("non-existant session");
assertNull(fsDb.getFeedbackSession("non-course", "Non-existant feedback session"));
______TS("null fsName");
try {
fsDb.getFeedbackSession("idOfTypicalCourse1", null);
signalFailureToDetectException();
} catch (AssertionError e) {
AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
}
______TS("null courseId");
try {
fsDb.getFeedbackSession(null, "First feedback session");
signalFailureToDetectException();
} catch (AssertionError e) {
AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
}
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsDbTest method testUpdateFeedbackSession.
@Test
public void testUpdateFeedbackSession() throws Exception {
______TS("null params");
try {
fsDb.updateFeedbackSession(null);
signalFailureToDetectException();
} catch (AssertionError e) {
AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
}
______TS("invalid feedback sesion attributes");
FeedbackSessionAttributes invalidFs = getNewFeedbackSession();
fsDb.deleteEntity(invalidFs);
fsDb.createEntity(invalidFs);
Instant afterEndTime = invalidFs.getEndTime().plus(Duration.ofDays(30));
invalidFs.setStartTime(afterEndTime);
invalidFs.setResultsVisibleFromTime(afterEndTime);
try {
fsDb.updateFeedbackSession(invalidFs);
signalFailureToDetectException();
} catch (InvalidParametersException e) {
assertEquals(String.format(TIME_FRAME_ERROR_MESSAGE, SESSION_END_TIME_FIELD_NAME, SESSION_START_TIME_FIELD_NAME), e.getLocalizedMessage());
}
______TS("feedback session does not exist");
FeedbackSessionAttributes nonexistantFs = getNewFeedbackSession();
nonexistantFs.setFeedbackSessionName("non existant fs");
nonexistantFs.setCourseId("non.existant.course");
try {
fsDb.updateFeedbackSession(nonexistantFs);
signalFailureToDetectException();
} catch (EntityDoesNotExistException e) {
AssertHelper.assertContains(FeedbackSessionsDb.ERROR_UPDATE_NON_EXISTENT, e.getLocalizedMessage());
}
______TS("standard success case");
FeedbackSessionAttributes modifiedSession = getNewFeedbackSession();
fsDb.deleteEntity(modifiedSession);
fsDb.createEntity(modifiedSession);
verifyPresentInDatastore(modifiedSession);
modifiedSession.setInstructions(new Text("new instructions"));
modifiedSession.setGracePeriodMinutes(0);
modifiedSession.setSentOpenEmail(false);
fsDb.updateFeedbackSession(modifiedSession);
verifyPresentInDatastore(modifiedSession);
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsDbTest method testGetFeedbackSessionsPossiblyNeedingClosingEmail.
private void testGetFeedbackSessionsPossiblyNeedingClosingEmail() {
______TS("standard success case");
List<FeedbackSessionAttributes> fsaList = fsDb.getFeedbackSessionsPossiblyNeedingClosingEmail();
assertEquals(7, fsaList.size());
for (FeedbackSessionAttributes fsa : fsaList) {
assertFalse(fsa.isSentClosingEmail());
assertTrue(fsa.isClosingEmailEnabled());
}
}
use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionsDbTest method testGetFeedbackSessionsPossiblyNeedingPublishedEmail.
private void testGetFeedbackSessionsPossiblyNeedingPublishedEmail() {
______TS("standard success case");
List<FeedbackSessionAttributes> fsaList = fsDb.getFeedbackSessionsPossiblyNeedingPublishedEmail();
assertEquals(9, fsaList.size());
for (FeedbackSessionAttributes fsa : fsaList) {
assertFalse(fsa.isSentPublishedEmail());
assertTrue(fsa.isPublishedEmailEnabled());
}
}
Aggregations