ProfileTemplate extends AbstractTemplate implements ProfileOperations { public XingProfile getUserProfile() { return getProfileById("me"); } ProfileTemplate(String xingBaseUrl, RestOperations restOperations, ObjectMapper objectMapper);  ProfileTemplate(RestOperations restOperations, ObjectMapper objectMapper); String getProfileId(); XingProfile getUserProfile(); XingProfile getProfileById(String id);  }
@Test public void getUserProfile() { mockServer.expect(requestTo(XingTemplate.DEFAULT_BASE_URL + ProfileTemplate.USERS_URL.replaceFirst("\\{id\\}", "me"))).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("testdata/profile.json", getClass()), MediaType.APPLICATION_JSON)); XingProfile userProfile = xing.profileOperations().getUserProfile(); assertEquals("6628146_33f97b", userProfile.getId()); assertEquals("Johannes", userProfile.getFirstName()); assertEquals("Bühler", userProfile.getLastName()); List<String> badges = userProfile.getBadges(); assertEquals(1, badges.size()); assertEquals("PREMIUM", badges.get(0)); assertThat(userProfile.getPermalink(), is(not(nullValue()))); assertThat(userProfile.getProfessionalExperience(), is(not(nullValue()))); assertEquals(2, userProfile.getProfessionalExperience().getNonPrimaryCompanies().size()); assertEquals("CANOOENGINEERINGAG", userProfile.getProfessionalExperience().getPrimaryCompany().getTag()); assertEquals(Integer.valueOf(1), userProfile.getProfessionalExperience().getPrimaryCompany().getBeginDate().getMonth()); assertEquals("Senior Software Engineer", userProfile.getProfessionalExperience().getPrimaryCompany().getTitle()); assertEquals(CareerLevel.PROFESSIONAL_EXPERIENCED, userProfile.getProfessionalExperience().getPrimaryCompany().getCareerLevel()); assertThat(userProfile.getEducationalBackground(), is(not(nullValue()))); assertEquals(2, userProfile.getEducationalBackground().getSchools().size()); assertEquals(3, userProfile.getEducationalBackground().getQualifications().size()); assertEquals("Java Design Patterns Course Certificate", userProfile.getEducationalBackground().getQualifications().get(2)); assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: assertEquals("http: }
@Test public void getFullUserProfile() { mockServer.expect(requestTo(XingTemplate.DEFAULT_BASE_URL + ProfileTemplate.USERS_URL.replaceFirst("\\{id\\}", "me"))).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("testdata/full_profile.json", getClass()), MediaType.APPLICATION_JSON)); XingProfile userProfile = xing.profileOperations().getUserProfile(); assertEquals(4, userProfile.getLanguages().size()); assertEquals("ACM, GI", userProfile.getOrganisationMember()); assertEquals("m", userProfile.getGender()); List<String> badges = userProfile.getBadges(); assertEquals(2, badges.size()); assertEquals("PREMIUM", badges.get(0)); assertEquals("MODERATOR", badges.get(1)); assertEquals("max.mustermann@xing.com", userProfile.getActiveEmail()); assertThat(userProfile.getEducationalBackground(), is(not(nullValue()))); assertEquals("1_abcdef", userProfile.getProfessionalExperience().getPrimaryCompany().getId()); assertEquals(Boolean.TRUE, userProfile.getProfessionalExperience().getPrimaryCompany().getUntilNow()); assertEquals(EmploymentStatus.EMPLOYEE, userProfile.getEmploymentStatus()); assertEquals(FormOfEmployment.FULL_TIME_EMPLOYEE, userProfile.getProfessionalExperience().getPrimaryCompany().getFormOfEmployment()); assertEquals("42_abcdef", userProfile.getEducationalBackground().getPrimarySchool().getId()); assertEquals(2, userProfile.getEducationalBackground().getQualifications().size()); assertEquals("PADI AOWD", userProfile.getEducationalBackground().getQualifications().get(1)); assertEquals(4, userProfile.getProfessionalExperience().getCompanies().size()); assertEquals("max.mustermann@xing.com", userProfile.getActiveEmail()); assertThat(userProfile.getEducationalBackground(), is(not(nullValue()))); assertEquals("1_abcdef", userProfile.getProfessionalExperience().getPrimaryCompany().getId()); assertEquals(Boolean.TRUE, userProfile.getProfessionalExperience().getPrimaryCompany().getUntilNow()); assertEquals(EmploymentStatus.EMPLOYEE, userProfile.getEmploymentStatus()); assertEquals(FormOfEmployment.FULL_TIME_EMPLOYEE, userProfile.getProfessionalExperience().getPrimaryCompany().getFormOfEmployment()); assertEquals("42_abcdef", userProfile.getEducationalBackground().getPrimarySchool().getId()); assertEquals(2, userProfile.getEducationalBackground().getQualifications().size()); assertEquals("PADI AOWD", userProfile.getEducationalBackground().getQualifications().get(1)); assertEquals(4, userProfile.getProfessionalExperience().getCompanies().size()); assertEquals("max@mustermann.de", userProfile.getPrivateAddress().getEmail()); }