@Test public void testGetProfileFirstTime() throws Exception { Profile profile = ofy().load().key(Key.create(Profile.class, user.getUserId())).now(); assertNull(profile); profile = conferenceApi.getProfile(user); assertNull(profile); }
@Test public void testGetProfile() throws Exception { conferenceApi.saveProfile(user, new ProfileForm(DISPLAY_NAME, TEE_SHIRT_SIZE)); // Fetch the Profile via the API. Profile profile = conferenceApi.getProfile(user); assertEquals(USER_ID, profile.getUserId()); assertEquals(EMAIL, profile.getMainEmail()); assertEquals(TEE_SHIRT_SIZE, profile.getTeeShirtSize()); assertEquals(DISPLAY_NAME, profile.getDisplayName()); }
@Test(expected = UnauthorizedException.class) public void testGetProfileWithoutUser() throws Exception { conferenceApi.getProfile(null); }