Search in sources :

Example 76 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class StudentsLogicTest method testGetStudentForRegistrationKey.

private void testGetStudentForRegistrationKey() {
    ______TS("null parameter");
    try {
        studentsLogic.getStudentForRegistrationKey(null);
        signalFailureToDetectException();
    } catch (AssertionError ae) {
        assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, ae.getMessage());
    }
    ______TS("non-exist student");
    String nonExistStudentKey = StringHelper.encrypt("nonExistKey");
    assertNull(studentsLogic.getStudentForRegistrationKey(nonExistStudentKey));
    ______TS("typical case");
    StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1");
    String course1Id = dataBundle.courses.get("typicalCourse1").getId();
    String studentKey = studentsLogic.getStudentForCourseIdAndGoogleId(course1Id, student1InCourse1.googleId).key;
    StudentAttributes actualStudent = studentsLogic.getStudentForRegistrationKey(StringHelper.encrypt(studentKey));
    assertEquals(student1InCourse1.googleId, actualStudent.googleId);
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

Example 77 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class StudentsLogicTest method testGetStudentForCourseIdAndGoogleId.

private void testGetStudentForCourseIdAndGoogleId() {
    ______TS("student in two courses");
    StudentAttributes studentInTwoCoursesInCourse1 = dataBundle.students.get("student2InCourse1");
    String googleIdOfstudentInTwoCourses = studentInTwoCoursesInCourse1.googleId;
    assertEquals(studentInTwoCoursesInCourse1.email, studentsLogic.getStudentForCourseIdAndGoogleId(studentInTwoCoursesInCourse1.course, googleIdOfstudentInTwoCourses).email);
    StudentAttributes studentInTwoCoursesInCourse2 = dataBundle.students.get("student2InCourse2");
    assertEquals(studentInTwoCoursesInCourse2.email, studentsLogic.getStudentForCourseIdAndGoogleId(studentInTwoCoursesInCourse2.course, googleIdOfstudentInTwoCourses).email);
    ______TS("student in zero courses");
    assertNull(studentsLogic.getStudentForCourseIdAndGoogleId("non-existent", "random-google-id"));
    ______TS("null parameters");
    try {
        studentsLogic.getStudentForCourseIdAndGoogleId("valid.course", null);
        signalFailureToDetectException();
    } catch (AssertionError ae) {
        assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, ae.getMessage());
    }
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

Example 78 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class InstructorFeedbackEditPageDataTest method allTests.

@Test
public void allTests() {
    ______TS("Typical case");
    // Setup
    InstructorFeedbackEditPageData data = new InstructorFeedbackEditPageData(dataBundle.accounts.get("instructor1OfCourse1"), dummySessionToken);
    FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1");
    List<FeedbackQuestionAttributes> questions = new ArrayList<>();
    questions.add(dataBundle.feedbackQuestions.get("qn1InSession1InCourse1"));
    questions.add(dataBundle.feedbackQuestions.get("qn2InSession1InCourse1"));
    questions.add(dataBundle.feedbackQuestions.get("qn3InSession1InCourse1"));
    Map<String, Boolean> questionHasResponses = new HashMap<>();
    questionHasResponses.put(dataBundle.feedbackQuestions.get("qn1InSession1InCourse1").getId(), true);
    List<StudentAttributes> studentList = new ArrayList<>();
    studentList.add(dataBundle.students.get("student1InCourse1"));
    List<InstructorAttributes> instructorList = new ArrayList<>();
    instructorList.add(dataBundle.instructors.get("instructor1OfCourse1"));
    InstructorAttributes instructor = getInstructorFromBundle("instructor1OfCourse1");
    CourseDetailsBundle courseDetails = new CourseDetailsBundle(dataBundle.courses.get("typicalCourse1"));
    data.init(fs, questions, questionHasResponses, studentList, instructorList, instructor, true, instructorList.size(), courseDetails);
    // Test fs form
    FeedbackSessionsForm fsForm = data.getFsForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_COPY_PAGE).withUserId(instructor.googleId).toString(), fsForm.getCopyToLink());
    assertEquals(fs.getCourseId(), fsForm.getCourseId());
    assertNull(fsForm.getCourses());
    assertNull(fsForm.getCoursesSelectField());
    assertFalse(fsForm.isFeedbackSessionTypeEditable());
    assertTrue(fsForm.isEditFsButtonsVisible());
    assertNull(fsForm.getFeedbackSessionTypeOptions());
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_SAVE).toString(), fsForm.getFormSubmitAction());
    assertEquals(data.getInstructorFeedbackDeleteLink(fs.getCourseId(), fs.getFeedbackSessionName(), Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE), fsForm.getFsDeleteLink());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getEndTimeLocal()), fsForm.getFsEndDate());
    assertEquals(fs.getFeedbackSessionName(), fsForm.getFsName());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getStartTimeLocal()), fsForm.getFsStartDate());
    assertEquals(SanitizationHelper.sanitizeForHtml(fs.getInstructions().getValue()), fsForm.getInstructions());
    assertEquals("Save Changes", fsForm.getSubmitButtonText());
    assertFalse(fsForm.isCourseIdEditable());
    assertFalse(fsForm.isShowNoCoursesMessage());
    assertFalse(fsForm.isSubmitButtonVisible());
    assertFalse(fsForm.isSubmitButtonDisabled());
    FeedbackSessionsAdditionalSettingsFormSegment additionalSettings = data.getFsForm().getAdditionalSettings();
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getResultsVisibleFromTimeLocal()), additionalSettings.getResponseVisibleDateValue());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getSessionVisibleFromTimeLocal()), additionalSettings.getSessionVisibleDateValue());
    assertFalse(additionalSettings.isResponseVisiblePublishManuallyChecked());
    assertTrue(additionalSettings.isResponseVisibleDateChecked());
    assertFalse(additionalSettings.isResponseVisibleImmediatelyChecked());
    assertFalse(additionalSettings.isResponseVisibleDateDisabled());
    assertFalse(additionalSettings.isSessionVisibleAtOpenChecked());
    assertFalse(additionalSettings.isSessionVisibleDateDisabled());
    assertTrue(additionalSettings.isSessionVisibleDateButtonChecked());
    assertFalse(additionalSettings.isSessionVisiblePrivateChecked());
    assertTrue(additionalSettings.isSendClosingEmailChecked());
    assertTrue(additionalSettings.isSendOpeningEmailChecked());
    assertTrue(additionalSettings.isSendPublishedEmailChecked());
    // test question edit forms
    List<FeedbackQuestionEditForm> questionForms = data.getQnForms();
    assertEquals(3, questionForms.size());
    assertEquals(Const.ActionURIs.INSTRUCTOR_FEEDBACK_QUESTION_EDIT, questionForms.get(0).getAction());
    assertEquals(fs.getCourseId(), questionForms.get(0).getCourseId());
    assertEquals(fs.getFeedbackSessionName(), questionForms.get(0).getFeedbackSessionName());
    String questionTextOfFirstQuestion = dataBundle.feedbackQuestions.get("qn1InSession1InCourse1").getQuestionDetails().getQuestionText();
    assertEquals(questionTextOfFirstQuestion, questionForms.get(0).getQuestionText());
    assertEquals(3, questionForms.get(0).getQuestionNumberOptions().size());
    assertEquals("What is the best selling point of your product?", questionForms.get(0).getQuestionText());
    FeedbackQuestionFeedbackPathSettings feedbackPath = questionForms.get(0).getFeedbackPathSettings();
    assertTrue(feedbackPath.isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(DEFAULT_NUM_ENTITIES_TO_GIVE_RESPONSES_TO, feedbackPath.getNumOfEntitiesToGiveFeedbackToValue());
    assertEquals(1, questionForms.get(0).getQuestionIndex());
    // Test visibility settings for the zero'th question form
    FeedbackQuestionVisibilitySettings visibilitySettings = questionForms.get(0).getVisibilitySettings();
    verifyMapContains(visibilitySettings.getResponseVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    verifyMapContains(visibilitySettings.getGiverNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    verifyMapContains(visibilitySettings.getRecipientNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    assertEquals("Rate 1 other student's product", questionForms.get(1).getQuestionText());
    assertTrue(questionForms.get(1).getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(DEFAULT_NUM_ENTITIES_TO_GIVE_RESPONSES_TO, questionForms.get(1).getFeedbackPathSettings().getNumOfEntitiesToGiveFeedbackToValue());
    verifyMapContains(questionForms.get(1).getVisibilitySettings().getResponseVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER));
    verifyMapContains(questionForms.get(1).getVisibilitySettings().getGiverNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    verifyMapContains(questionForms.get(1).getVisibilitySettings().getRecipientNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER));
    assertEquals("My comments on the class", questionForms.get(2).getQuestionText());
    assertEquals(3, questionForms.get(2).getQuestionIndex());
    assertFalse(questionForms.get(2).getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(DEFAULT_NUM_ENTITIES_TO_GIVE_RESPONSES_TO, questionForms.get(2).getFeedbackPathSettings().getNumOfEntitiesToGiveFeedbackToValue());
    verifyMapContains(questionForms.get(2).getVisibilitySettings().getResponseVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.OWN_TEAM_MEMBERS));
    verifyMapContains(questionForms.get(2).getVisibilitySettings().getGiverNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.OWN_TEAM_MEMBERS));
    verifyMapContains(questionForms.get(2).getVisibilitySettings().getRecipientNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.OWN_TEAM_MEMBERS));
    // TODO test specific question edit form html after it is no longer html in java
    // test question add form
    FeedbackQuestionEditForm newQuestionForm = data.getNewQnForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    assertFalse(newQuestionForm.getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(-1, newQuestionForm.getQuestionIndex());
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    // preview form
    FeedbackSessionPreviewForm previewForm = data.getPreviewForm();
    assertEquals(1, previewForm.getStudentToPreviewAsOptions().size());
    assertEquals(1, previewForm.getInstructorToPreviewAsOptions().size());
    ______TS("empty feedback session");
    // setup
    data = new InstructorFeedbackEditPageData(dataBundle.accounts.get("instructor1OfCourse1"), dummySessionToken);
    fs = dataBundle.feedbackSessions.get("empty.session");
    fs.setPublishedEmailEnabled(false);
    fs.setClosingEmailEnabled(false);
    questions = new ArrayList<>();
    questionHasResponses = new HashMap<>();
    studentList = new ArrayList<>();
    instructorList = new ArrayList<>();
    instructor = getInstructorFromBundle("instructor1OfCourse1");
    courseDetails = new CourseDetailsBundle(dataBundle.courses.get("typicalCourse1"));
    data.init(fs, questions, questionHasResponses, studentList, instructorList, instructor, true, instructorList.size(), courseDetails);
    fsForm = data.getFsForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_COPY_PAGE).withUserId(instructor.googleId).toString(), fsForm.getCopyToLink());
    assertEquals(fs.getCourseId(), fsForm.getCourseId());
    assertNull(fsForm.getCourses());
    assertNull(fsForm.getCoursesSelectField());
    assertFalse(fsForm.isFeedbackSessionTypeEditable());
    assertTrue(fsForm.isEditFsButtonsVisible());
    assertNull(fsForm.getFeedbackSessionTypeOptions());
    additionalSettings = data.getFsForm().getAdditionalSettings();
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getResultsVisibleFromTimeLocal()), additionalSettings.getResponseVisibleDateValue());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getSessionVisibleFromTimeLocal()), additionalSettings.getSessionVisibleDateValue());
    assertFalse(additionalSettings.isResponseVisiblePublishManuallyChecked());
    assertTrue(additionalSettings.isResponseVisibleDateChecked());
    assertFalse(additionalSettings.isResponseVisibleImmediatelyChecked());
    assertFalse(additionalSettings.isResponseVisibleDateDisabled());
    assertFalse(additionalSettings.isSessionVisibleAtOpenChecked());
    assertFalse(additionalSettings.isSessionVisibleDateDisabled());
    assertTrue(additionalSettings.isSessionVisibleDateButtonChecked());
    assertFalse(additionalSettings.isSessionVisiblePrivateChecked());
    assertFalse(additionalSettings.isSendClosingEmailChecked());
    assertTrue(additionalSettings.isSendOpeningEmailChecked());
    assertFalse(additionalSettings.isSendPublishedEmailChecked());
    questionForms = data.getQnForms();
    assertEquals(questions.size(), questionForms.size());
    previewForm = data.getPreviewForm();
    assertEquals(studentList.size(), previewForm.getStudentToPreviewAsOptions().size());
    assertEquals(instructorList.size(), previewForm.getInstructorToPreviewAsOptions().size());
    newQuestionForm = data.getNewQnForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    assertFalse(newQuestionForm.getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    ______TS("Resolved time fields map");
    data = new InstructorFeedbackEditPageData(dataBundle.accounts.get("instructor1OfCourse1"), dummySessionToken);
    assertNotNull("Should be empty map if unused", data.getResolvedTimeFields());
    assertTrue(data.getResolvedTimeFields().isEmpty());
    Map<String, String> expected = new HashMap<>();
    String startDate = "start date";
    String startTime = "start time";
    expected.put(Const.ParamsNames.FEEDBACK_SESSION_STARTDATE, startDate);
    expected.put(Const.ParamsNames.FEEDBACK_SESSION_STARTTIME, startTime);
    data.putResolvedTimeField(Const.ParamsNames.FEEDBACK_SESSION_STARTDATE, startDate);
    data.putResolvedTimeField(Const.ParamsNames.FEEDBACK_SESSION_STARTTIME, startTime);
    assertEquals(expected, data.getResolvedTimeFields());
}
Also used : InstructorFeedbackEditPageData(teammates.ui.pagedata.InstructorFeedbackEditPageData) FeedbackQuestionVisibilitySettings(teammates.ui.template.FeedbackQuestionVisibilitySettings) HashMap(java.util.HashMap) FeedbackSessionPreviewForm(teammates.ui.template.FeedbackSessionPreviewForm) ArrayList(java.util.ArrayList) FeedbackSessionsForm(teammates.ui.template.FeedbackSessionsForm) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) FeedbackQuestionFeedbackPathSettings(teammates.ui.template.FeedbackQuestionFeedbackPathSettings) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) FeedbackQuestionEditForm(teammates.ui.template.FeedbackQuestionEditForm) FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) CourseDetailsBundle(teammates.common.datatransfer.CourseDetailsBundle) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackSessionsAdditionalSettingsFormSegment(teammates.ui.template.FeedbackSessionsAdditionalSettingsFormSegment) Test(org.testng.annotations.Test)

Example 79 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class StudentCourseDetailsPageDataTest method test.

@Test
public void test() {
    ______TS("typical success case");
    AccountAttributes account = dataBundle.accounts.get("student1InCourse1");
    StudentCourseDetailsPageData pageData = new StudentCourseDetailsPageData(account, dummySessionToken);
    StudentAttributes student = dataBundle.students.get("student1InCourse1");
    CourseAttributes course = dataBundle.courses.get("typicalCourse1");
    CourseDetailsBundle courseDetails = new CourseDetailsBundle(course);
    List<InstructorAttributes> instructors = new ArrayList<>();
    instructors.add(dataBundle.instructors.get("instructor1OfCourse1"));
    instructors.add(dataBundle.instructors.get("instructor2OfCourse1"));
    instructors.add(dataBundle.instructors.get("helperOfCourse1"));
    TeamDetailsBundle team = new TeamDetailsBundle();
    team.name = student.team;
    // Get team members of student
    for (Entry<String, StudentAttributes> entry : dataBundle.students.entrySet()) {
        StudentAttributes currStudent = entry.getValue();
        if (currStudent.team.equals(team.name)) {
            team.students.add(currStudent);
        }
    }
    pageData.init(courseDetails, instructors, student, team);
    List<InstructorAttributes> courseInstructors = pageData.getStudentCourseDetailsPanel().getInstructors();
    List<StudentAttributes> teammates = pageData.getStudentCourseDetailsPanel().getTeammates();
    assertEquals(courseDetails.course.getName(), pageData.getStudentCourseDetailsPanel().getCourseName());
    assertEquals(courseDetails.course.getId(), pageData.getStudentCourseDetailsPanel().getCourseId());
    assertFalse(courseInstructors.isEmpty());
    assertFalse(teammates.isEmpty());
    assertEquals(student.email, pageData.getStudentCourseDetailsPanel().getStudentEmail());
    assertEquals(student.name, pageData.getStudentCourseDetailsPanel().getStudentName());
    assertEquals(team.name, pageData.getStudentCourseDetailsPanel().getStudentTeam());
    assertEquals(instructors.size(), courseInstructors.size());
    assertEquals(instructors.get(0).name, courseInstructors.get(0).name);
    assertEquals(instructors.get(1).name, courseInstructors.get(1).name);
    assertEquals(instructors.get(2).name, courseInstructors.get(2).name);
    assertEquals(instructors.get(0).displayedName, courseInstructors.get(0).displayedName);
    assertEquals(instructors.get(1).displayedName, courseInstructors.get(1).displayedName);
    assertEquals(instructors.get(2).displayedName, courseInstructors.get(2).displayedName);
    assertEquals(team.students.size(), teammates.size());
    ______TS("student in unregistered course");
    student = dataBundle.students.get("student1InUnregisteredCourse");
    course = dataBundle.courses.get("unregisteredCourse");
    courseDetails = new CourseDetailsBundle(course);
    instructors = new ArrayList<>();
    instructors.add(dataBundle.instructors.get("instructor5"));
    team = new TeamDetailsBundle();
    team.name = student.team;
    // Get team members of student
    for (Entry<String, StudentAttributes> entry : dataBundle.students.entrySet()) {
        StudentAttributes currStudent = entry.getValue();
        if (currStudent.team.equals(team.name)) {
            team.students.add(currStudent);
        }
    }
    pageData.init(courseDetails, instructors, student, team);
    courseInstructors = pageData.getStudentCourseDetailsPanel().getInstructors();
    teammates = pageData.getStudentCourseDetailsPanel().getTeammates();
    assertEquals(courseDetails.course.getName(), pageData.getStudentCourseDetailsPanel().getCourseName());
    assertEquals(courseDetails.course.getId(), pageData.getStudentCourseDetailsPanel().getCourseId());
    assertFalse(courseInstructors.isEmpty());
    assertFalse(teammates.isEmpty());
    assertEquals(student.email, pageData.getStudentCourseDetailsPanel().getStudentEmail());
    assertEquals(student.name, pageData.getStudentCourseDetailsPanel().getStudentName());
    assertEquals(team.name, pageData.getStudentCourseDetailsPanel().getStudentTeam());
    assertEquals(instructors.size(), courseInstructors.size());
    assertEquals(instructors.get(0).name, courseInstructors.get(0).name);
    assertEquals(instructors.get(0).displayedName, courseInstructors.get(0).displayedName);
    assertEquals(team.students.size(), teammates.size());
    ______TS("student in archived course");
    student = dataBundle.students.get("student1InArchivedCourse");
    course = dataBundle.courses.get("archivedCourse");
    courseDetails = new CourseDetailsBundle(course);
    instructors = new ArrayList<>();
    instructors.add(dataBundle.instructors.get("instructorOfArchivedCourse"));
    team = new TeamDetailsBundle();
    team.name = student.team;
    // Get team members of student
    for (Entry<String, StudentAttributes> entry : dataBundle.students.entrySet()) {
        StudentAttributes currStudent = entry.getValue();
        if (currStudent.team.equals(team.name)) {
            team.students.add(currStudent);
        }
    }
    pageData.init(courseDetails, instructors, student, team);
    courseInstructors = pageData.getStudentCourseDetailsPanel().getInstructors();
    teammates = pageData.getStudentCourseDetailsPanel().getTeammates();
    assertEquals(courseDetails.course.getName(), pageData.getStudentCourseDetailsPanel().getCourseName());
    assertEquals(courseDetails.course.getId(), pageData.getStudentCourseDetailsPanel().getCourseId());
    assertFalse(courseInstructors.isEmpty());
    assertFalse(teammates.isEmpty());
    assertEquals(student.email, pageData.getStudentCourseDetailsPanel().getStudentEmail());
    assertEquals(student.name, pageData.getStudentCourseDetailsPanel().getStudentName());
    assertEquals(team.name, pageData.getStudentCourseDetailsPanel().getStudentTeam());
    assertEquals(instructors.size(), courseInstructors.size());
    assertEquals(instructors.get(0).name, courseInstructors.get(0).name);
    assertEquals(instructors.get(0).displayedName, courseInstructors.get(0).displayedName);
    assertEquals(team.students.size(), teammates.size());
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) ArrayList(java.util.ArrayList) StudentCourseDetailsPageData(teammates.ui.pagedata.StudentCourseDetailsPageData) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) CourseDetailsBundle(teammates.common.datatransfer.CourseDetailsBundle) TeamDetailsBundle(teammates.common.datatransfer.TeamDetailsBundle) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) Test(org.testng.annotations.Test)

Example 80 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class StudentAttributesTest method testToEnrollmentString.

@Test
public void testToEnrollmentString() {
    StudentAttributes sd = StudentAttributes.builder("course1", "name 1", "email@email.com").withSection("sect 1").withComments("comment 1").withTeam("team 1").build();
    assertEquals("sect 1|team 1|name 1|email@email.com|comment 1", sd.toEnrollmentString());
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) Test(org.testng.annotations.Test)

Aggregations

StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)241 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)85 Test (org.testng.annotations.Test)80 ArrayList (java.util.ArrayList)55 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)33 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)33 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)30 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)27 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)22 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)17 ShowPageResult (teammates.ui.controller.ShowPageResult)15 HashMap (java.util.HashMap)14 TeamDetailsBundle (teammates.common.datatransfer.TeamDetailsBundle)14 InvalidParametersException (teammates.common.exception.InvalidParametersException)14 EmailWrapper (teammates.common.util.EmailWrapper)13 RedirectResult (teammates.ui.controller.RedirectResult)12 List (java.util.List)11 StatusMessage (teammates.common.util.StatusMessage)10 HashSet (java.util.HashSet)9 StudentEnrollDetails (teammates.common.datatransfer.StudentEnrollDetails)9