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);
}
Aggregations