MessageGeneratorUtils { public NhinTargetSystemType convertFirstToNhinTargetSystemType(NhinTargetCommunitiesType targets) { NhinTargetSystemType nhinTargetSystem = new NhinTargetSystemType(); if (targets != null && CollectionUtils.isNotEmpty(targets.getNhinTargetCommunity())) { nhinTargetSystem.setHomeCommunity(targets.getNhinTargetCommunity().get(0).getHomeCommunity()); nhinTargetSystem.setUseSpecVersion(targets.getUseSpecVersion()); nhinTargetSystem.setExchangeName(targets.getExchangeName()); } return nhinTargetSystem; } protected  MessageGeneratorUtils(); static MessageGeneratorUtils getInstance(); NhinTargetSystemType convertFirstToNhinTargetSystemType(NhinTargetCommunitiesType targets); NhinTargetSystemType convertToNhinTargetSystemType(NhinTargetCommunityType target); AssertionType clone(AssertionType assertion); AssertionType cloneWithNewMsgId(AssertionType assertion); AdhocQueryRequest clone(AdhocQueryRequest adhocQueryRequest); PRPAIN201305UV02 clone(PRPAIN201305UV02 request); AssertionType generateMessageId(AssertionType assertion); RegistryResponseType createRegistryErrorResponse(String errorMsg, String errorCode, String status); RegistryResponseType createFailedPolicyCheckResponse(); RegistryResponseType createRegistryErrorResponse(); XDRAcknowledgementType createXDRAckWithRegistryErrorResponse(); RegistryResponseType createMissingDocumentRegistryResponse(); RegistryResponseType createRegistryErrorResponseWithAckFailure(String errorMsg); RegistryResponseType createRegistryBusyErrorResponse(String errorMsg); XDRAcknowledgementType createRegistryErrorXDRAcknowledgementType(String errorMsg); XDRAcknowledgementType createMissingDocumentXDRAcknowledgementType(); XDRAcknowledgementType createFailedPolicyCheckXDRAcknowledgementType(); RegistryResponseType createRegistryResponseSuccess();  }
@Test public void convertFirstToNhinTargetSystemType() { assertNull(msgUtils.convertFirstToNhinTargetSystemType(null).getHomeCommunity()); NhinTargetCommunitiesType targets = new NhinTargetCommunitiesType(); assertNull(msgUtils.convertFirstToNhinTargetSystemType(targets).getHomeCommunity()); NhinTargetCommunityType targetCommunity = new NhinTargetCommunityType(); targetCommunity.setHomeCommunity(new HomeCommunityType()); targetCommunity.getHomeCommunity().setHomeCommunityId("1.1"); targets.getNhinTargetCommunity().add(targetCommunity); assertEquals("1.1", msgUtils.convertFirstToNhinTargetSystemType(targets).getHomeCommunity() .getHomeCommunityId()); NhinTargetCommunityType targetCommunity2 = new NhinTargetCommunityType(); targetCommunity2.setHomeCommunity(new HomeCommunityType()); targetCommunity2.getHomeCommunity().setHomeCommunityId("2.2"); targets.getNhinTargetCommunity().add(targetCommunity2); assertEquals(2, targets.getNhinTargetCommunity().size()); assertEquals("1.1", msgUtils.convertFirstToNhinTargetSystemType(targets).getHomeCommunity() .getHomeCommunityId()); }