HomeCommunityMap { public static String getCommunityIdFromTargetCommunities(NhinTargetCommunitiesType target) { String responseCommunityId = null; if (target != null && NullChecker.isNotNullish(target.getNhinTargetCommunity()) && target.getNhinTargetCommunity().get(0) != null) { responseCommunityId = target.getNhinTargetCommunity().get(0).getHomeCommunity().getHomeCommunityId(); } LOG.debug("=====>>>>> responseCommunityId is " + responseCommunityId); return formatHomeCommunityId(responseCommunityId); }  static String getSNIName(String exchangeName); static String getHomeCommunityName(String sHomeCommunityId); static String getCommunityIdFromTargetCommunities(NhinTargetCommunitiesType target); static String getCommunityIdFromTargetSystem(NhinTargetSystemType target); static String getCommunityIdFromAssertion(AssertionType assertion); static String getHomeCommunityIdFromAssertion(AssertionType assertion); static String getCommunityId(AdhocQueryType body); static String getCommunityIdForDeferredQDResponse(AdhocQueryResponse body); static String getCommunityIdForRDRequest(RetrieveDocumentSetRequestType body); static String getCommunityIdForDeferredRDResponse(RetrieveDocumentSetResponseType body); static String formatHomeCommunityId(String communityId); static String getLocalHomeCommunityId(); static String getHomeCommunityIdWithPrefix(String communityId); static String getHomeCommunityWithoutPrefix(String hcid); static String appendPrefixHomeCommunityID(final String homeCommunityId); static boolean equalsIgnoreCaseForHCID(final String communityId, final String hcidValue); static String checkPrefixBeforeAppend(final String checkValue, final String checkPrefix);  }
@Test public void testGetCommunityIdFromTargetCommunities() { String communityId = HomeCommunityMap.getCommunityIdFromTargetCommunities(null); assertEquals(null, communityId); NhinTargetCommunitiesType target = new NhinTargetCommunitiesType(); communityId = HomeCommunityMap.getCommunityIdFromTargetCommunities(target); assertEquals(null, communityId); NhinTargetCommunityType targetCommunity = new NhinTargetCommunityType(); HomeCommunityType home = new HomeCommunityType(); targetCommunity.setHomeCommunity(home); target.getNhinTargetCommunity().add(targetCommunity); communityId = HomeCommunityMap.getCommunityIdFromTargetCommunities(target); assertEquals(null, communityId); target.getNhinTargetCommunity().get(0).getHomeCommunity().setHomeCommunityId("1.1"); communityId = HomeCommunityMap.getCommunityIdFromTargetCommunities(target); assertEquals("1.1", communityId); }