Search in sources :

Example 11 with StudentProfileAttributes

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

the class StudentProfileAttributesTest method testDefaultValueForGenderIfNullPassed.

@Test
public void testDefaultValueForGenderIfNullPassed() {
    StudentProfileAttributes profileAttributes = StudentProfileAttributes.builder(VALID_GOOGLE_ID).withGender(null).build();
    assertIsDefaultValues(profileAttributes);
}
Also used : StudentProfileAttributes(teammates.common.datatransfer.attributes.StudentProfileAttributes) Test(org.testng.annotations.Test)

Example 12 with StudentProfileAttributes

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

the class StudentProfileAttributesTest method testGetInvalidityInfoForValidProfileWithEmptyValues.

private void testGetInvalidityInfoForValidProfileWithEmptyValues() {
    StudentProfileAttributes validProfile = profile.getCopy();
    ______TS("Typical case: valid profile with empty attributes");
    validProfile.shortName = "";
    validProfile.email = "";
    validProfile.nationality = "";
    validProfile.institute = "";
    assertTrue("'validProfile' indicated as invalid", validProfile.isValid());
    assertEquals(new ArrayList<String>(), validProfile.getInvalidityInfo());
}
Also used : StudentProfileAttributes(teammates.common.datatransfer.attributes.StudentProfileAttributes)

Example 13 with StudentProfileAttributes

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

the class StudentProfileAttributesTest method testGetJsonString.

@Test
public void testGetJsonString() throws Exception {
    StudentProfileAttributes spa = StudentProfileAttributes.valueOf(profile.toEntity());
    spa.modifiedDate = TimeHelper.parseInstant("2015-05-21 8:34 AM +0000");
    assertEquals("{\n  \"googleId\": \"valid.googleId\",\n  \"shortName\": \"shor\"," + "\n  \"email\": \"valid@email.com\",\n  \"institute\": \"institute\"," + "\n  \"nationality\": \"Lebanese\",\n  \"gender\": \"female\"," + "\n  \"moreInfo\": \"moreInfo can have a lot more than this...\"," + "\n  \"pictureKey\": \"profile Pic Key\"," + "\n  \"modifiedDate\": \"2015-05-21T08:34:00Z\"\n}", spa.getJsonString());
}
Also used : StudentProfileAttributes(teammates.common.datatransfer.attributes.StudentProfileAttributes) Test(org.testng.annotations.Test)

Example 14 with StudentProfileAttributes

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

the class StudentProfileAttributesTest method testToString.

@Test
public void testToString() {
    StudentProfileAttributes spa = StudentProfileAttributes.valueOf(profile.toEntity());
    profile.modifiedDate = spa.modifiedDate;
    // the toString must be unique to the values in the object
    assertEquals(profile.toString(), spa.toString());
}
Also used : StudentProfileAttributes(teammates.common.datatransfer.attributes.StudentProfileAttributes) Test(org.testng.annotations.Test)

Example 15 with StudentProfileAttributes

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

the class StudentProfileAttributesTest method testToEntity.

@Override
@Test
public void testToEntity() {
    StudentProfile expectedEntity = createStudentProfileFrom(profile);
    StudentProfileAttributes testProfile = StudentProfileAttributes.valueOf(expectedEntity);
    StudentProfile actualEntity = testProfile.toEntity();
    assertEquals(expectedEntity.getShortName(), actualEntity.getShortName());
    assertEquals(expectedEntity.getInstitute(), actualEntity.getInstitute());
    assertEquals(expectedEntity.getEmail(), actualEntity.getEmail());
    assertEquals(expectedEntity.getNationality(), actualEntity.getNationality());
    assertEquals(expectedEntity.getGender(), actualEntity.getGender());
    assertEquals(expectedEntity.getMoreInfo(), actualEntity.getMoreInfo());
    assertEquals(expectedEntity.getModifiedDate().toString(), actualEntity.getModifiedDate().toString());
    assertEquals(expectedEntity.getPictureKey(), actualEntity.getPictureKey());
}
Also used : StudentProfile(teammates.storage.entity.StudentProfile) StudentProfileAttributes(teammates.common.datatransfer.attributes.StudentProfileAttributes) Test(org.testng.annotations.Test)

Aggregations

StudentProfileAttributes (teammates.common.datatransfer.attributes.StudentProfileAttributes)45 Test (org.testng.annotations.Test)15 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)11 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)7 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)6 BlobKey (com.google.appengine.api.blobstore.BlobKey)5 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)5 RedirectResult (teammates.ui.controller.RedirectResult)5 ArrayList (java.util.ArrayList)4 InvalidParametersException (teammates.common.exception.InvalidParametersException)4 StatusMessage (teammates.common.util.StatusMessage)4 StudentProfile (teammates.storage.entity.StudentProfile)4 StudentProfileEditSaveAction (teammates.ui.controller.StudentProfileEditSaveAction)4 CourseDetailsBundle (teammates.common.datatransfer.CourseDetailsBundle)3 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)3 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)3 Text (com.google.appengine.api.datastore.Text)2 ShowPageResult (teammates.ui.controller.ShowPageResult)2 InstructorStudentRecordsPageData (teammates.ui.pagedata.InstructorStudentRecordsPageData)2 Key (com.googlecode.objectify.Key)1