### Question:
Jive6ContributorProfileProvider implements ContributorProfileProvider { @SuppressWarnings("unchecked") protected String getProfileValue(Map<String, Object> jiveObject, String jiveLabel) { if (jiveObject == null) return null; try { List<Map<String, Object>> profileObject = (List<Map<String, Object>>) jiveObject.get("profile"); if (profileObject != null) { for (Map<String, Object> profileItem : profileObject) { if (jiveLabel.equals(profileItem.get(JIVE_PROFILE_NAME_KEY))) { return (String) profileItem.get(JIVE_PROFILE_VALUE_KEY); } } } } catch (ClassCastException e) { log.warning("bad structure of jive profile data"); } 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 getProfileValue() { Jive6ContributorProfileProvider tested = getTested(); Assert.assertNull(tested.getProfileValue(null, "testlabel")); Map<String, Object> jiveObject = new HashMap<>(); Assert.assertNull(tested.getProfileValue(jiveObject, "testlabel")); jiveObject.put("profile", "badtype"); Assert.assertNull(tested.getProfileValue(jiveObject, "testlabel")); List<Map<String, Object>> profileObject = new ArrayList<Map<String, Object>>(); jiveObject.put("profile", profileObject); Assert.assertNull(tested.getProfileValue(jiveObject, "testlabel")); profileObject.add(createProfileValueStructure("field1", "value1")); Assert.assertNull(tested.getProfileValue(jiveObject, "testlabel")); profileObject.add(createProfileValueStructure("testlabel", "testvalue")); Assert.assertEquals("testvalue", tested.getProfileValue(jiveObject, "testlabel")); }