Search in sources :

Example 1 with ProfilesDb

use of teammates.storage.api.ProfilesDb in project teammates by TEAMMATES.

the class AccountAttributesTest method testToEntity.

@Override
@Test
public void testToEntity() {
    AccountAttributes account = createValidAccountAttributesObject();
    Account expectedAccount = new Account(account.googleId, account.name, account.isInstructor, account.email, account.institute, account.studentProfile.toEntity());
    Account actualAccount = account.toEntity();
    assertEquals(expectedAccount.getGoogleId(), actualAccount.getGoogleId());
    assertEquals(expectedAccount.getName(), actualAccount.getName());
    assertEquals(expectedAccount.getEmail(), actualAccount.getEmail());
    assertEquals(expectedAccount.getInstitute(), actualAccount.getInstitute());
    assertEquals(expectedAccount.isInstructor(), actualAccount.isInstructor());
    ProfilesDb profilesDb = new ProfilesDb();
    profilesDb.saveEntity(account.studentProfile.toEntity());
    String expectedProfile = StudentProfileAttributes.valueOf(expectedAccount.getStudentProfile()).toString();
    String actualProfile = StudentProfileAttributes.valueOf(actualAccount.getStudentProfile()).toString();
    assertEquals(expectedProfile, actualProfile);
    profilesDb.deleteEntity(account.studentProfile);
}
Also used : Account(teammates.storage.entity.Account) ProfilesDb(teammates.storage.api.ProfilesDb) AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)1 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)1 ProfilesDb (teammates.storage.api.ProfilesDb)1 Account (teammates.storage.entity.Account)1