HomeCommunityMap { public static String formatHomeCommunityId(String communityId) { if (communityId != null) { if (communityId.startsWith(HCID_PREFIX)) { communityId = communityId.substring(8); } } return communityId; }  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 testFormatHomeCommunityId() { RetrieveDocumentSetResponseType doc = new RetrieveDocumentSetResponseType(); DocumentResponse docResponse = new DocumentResponse(); docResponse.setHomeCommunityId("1.1"); doc.getDocumentResponse().add(docResponse); String communityId = HomeCommunityMap.getCommunityIdForDeferredRDResponse(doc); assertEquals("1.1", communityId); docResponse.setHomeCommunityId("urn:oid:1.1"); communityId = HomeCommunityMap.getCommunityIdForDeferredRDResponse(doc); assertEquals("1.1", communityId); docResponse.setHomeCommunityId("randomstring"); communityId = HomeCommunityMap.getCommunityIdForDeferredRDResponse(doc); assertEquals("randomstring", communityId); }