@Test
public void testUpdateProfile() throws Exception {
// Save for the first time.
conferenceApi.saveProfile(user, new ProfileForm(DISPLAY_NAME, TEE_SHIRT_SIZE));
Profile profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now();
assertEquals(USER_ID, profile.getUserId());
assertEquals(EMAIL, profile.getMainEmail());
assertEquals(TEE_SHIRT_SIZE, profile.getTeeShirtSize());
assertEquals(DISPLAY_NAME, profile.getDisplayName());
// Then try to update it.
String newDisplayName = "Kay's Daddy";
TeeShirtSize newTeeShirtSize = TeeShirtSize.L;
conferenceApi.saveProfile(user, new ProfileForm(newDisplayName, newTeeShirtSize));
profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now();
assertEquals(USER_ID, profile.getUserId());
assertEquals(EMAIL, profile.getMainEmail());
assertEquals(newTeeShirtSize, profile.getTeeShirtSize());
assertEquals(newDisplayName, profile.getDisplayName());
}