### Question:
Jive6ContributorProfileProvider implements ContributorProfileProvider { protected ContributorProfile convertToProfile(byte[] data) { Map<String, Object> map = convertJSONMap(data); return mapRawJsonData(map); }  @PostConstruct void init(); @Override List<ContributorProfile> getAllProfiles(Integer start, Integer size); @Override ContributorProfile getProfile(String jbossorgUsername); @PreDestroy void destroy(); static final String JIVE_PROFILE_REST_API; static final String JIVE_ALL_PROFILES_REST_API; }### Answer:
@Test public void testConvertToProfile() throws Exception { Jive6ContributorProfileProvider provider = getTested(); InputStream is = Jive6ContributorProfileProviderTest.class.getResourceAsStream("Jive6ProfileData.json"); ContributorProfile profile = provider.convertToProfile(IOUtils.toByteArray(is)); Assert.assertEquals("lkrzyzanek", profile.getTypeSpecificCodes().get(ContributorProfileService.FIELD_TSC_JBOSSORG_USERNAME).get(0)); Assert.assertEquals("lkrzyzanek-ght", profile.getTypeSpecificCodes().get(ContributorProfileService.FIELD_TSC_GITHUB_USERNAME).get(0)); Assert.assertEquals("Libor Krzyzanek", profile.getFullName()); Assert.assertEquals("fake@fake.com", profile.getPrimaryEmail()); Assert.assertEquals(2, profile.getEmails().size()); Assert.assertTrue(profile.getEmails().contains("fake@fake.com")); Assert.assertTrue(profile.getEmails().contains("fake2@fake.com")); Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone("GMT")); calendar.set(Calendar.MILLISECOND, 0); calendar.set(2014, Calendar.OCTOBER, 25, 0, 0, 0); Assert.assertEquals(new Long(calendar.getTimeInMillis()), profile.getHireDate()); calendar.set(2014, Calendar.NOVEMBER, 19, 0, 0, 0); Assert.assertEquals(new Long(calendar.getTimeInMillis()), profile.getLeaveDate()); Map<String, Object> contributorProfile = profile.getProfileData(); Assert.assertNotNull(contributorProfile.remove(ContentObjectFields.SYS_UPDATED)); TestUtils.assertJsonContent( TestUtils.loadJSONFromClasspathFile("/org/searchisko/contribprofile/provider/Jive6ProfileDataConverted.json"), contributorProfile); }
@Test(expected = SettingsException.class) public void testConvertToProfile_emptyEmail() throws Exception { Jive6ContributorProfileProvider provider = getTested(); InputStream is = Jive6ContributorProfileProviderTest.class.getResourceAsStream("Jive6ProfileData_emptyEmail.json"); provider.convertToProfile(IOUtils.toByteArray(is)); }