### Question:
Jive6ContributorProfileProvider implements ContributorProfileProvider { protected String getPrimaryEmail(List<Map<String, Object>> emailsObject) { if (emailsObject == null) { log.log(Level.FINE, "Emails not returned in response from Jive. Probably bad authentication."); return null; } for (Map<String, Object> emailObject : emailsObject) { String email = (String) emailObject.get("value"); if ((boolean) emailObject.get("primary")) { return email; } } return null; }  @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 getPrimaryEmail() { Jive6ContributorProfileProvider tested = getTested(); Assert.assertNull(tested.getPrimaryEmail(null)); List<Map<String, Object>> emailsObject = new ArrayList<>(); Assert.assertNull(tested.getPrimaryEmail(emailsObject)); emailsObject.add(createEmailStructure("test@test.com", false)); Assert.assertNull(tested.getPrimaryEmail(emailsObject)); emailsObject.add(createEmailStructure("test2@test.com", true)); Assert.assertEquals("test2@test.com", tested.getPrimaryEmail(emailsObject)); }