AuditDataTransformHelper { public static AuditMessageType.ActiveParticipant createActiveParticipant(final String userId, final String altUserId, final String userName, final Boolean userIsReq) { final AuditMessageType.ActiveParticipant participant = new AuditMessageType.ActiveParticipant(); if (ipAddr == null) { try { ipAddr = InetAddress.getLocalHost().getHostAddress(); } catch (final UnknownHostException ex) { LOG.error("UnknownHostException thrown getting local host address: {}", ex.getLocalizedMessage(), ex); throw new RuntimeException(); } } if (StringUtils.isNotEmpty(userId)) { participant.setUserID(userId); } if (StringUtils.isNotEmpty(altUserId)) { participant.setAlternativeUserID(altUserId); } if (StringUtils.isNotEmpty(userName)) { participant.setUserName(userName); } participant.setUserIsRequestor(userIsReq); participant.setNetworkAccessPointID(ipAddr); participant.setNetworkAccessPointTypeCode(AuditDataTransformConstants.NETWORK_ACCESSOR_PT_TYPE_CODE_IP); return participant; }  static EventIdentificationType createEventIdentification(final String actionCode, final Integer eventOutcome,
        final CodedValueType eventId); static CodedValueType createEventId(final String eventCode, final String eventCodeSys,
        final String eventCodeSysName, final String dispName); static CodedValueType createCodeValueType(final String code, final String codeSys, final String codeSysName,
        final String dispName); static AuditMessageType.ActiveParticipant createActiveParticipantFromUser(final UserType userInfo,
        final Boolean userIsReq); static AuditMessageType.ActiveParticipant createActiveParticipant(final String userId,
        final String altUserId, final String userName, final Boolean userIsReq); static AuditSourceIdentificationType createAuditSourceIdentificationFromUser(final UserType userInfo); static AuditSourceIdentificationType createAuditSourceIdentification(final String communityId,
        final String communityName); static ParticipantObjectIdentificationType createParticipantObjectIdentification(final String patientId); static ParticipantObjectIdentificationType createDocumentParticipantObjectIdentification(
        final String documentId); static void logAuditMessage(final AuditMessageType message); static ExternalIdentifierType findSingleExternalIdentifier(final List<ExternalIdentifierType> olExtId,
        final String sIdentScheme); static String findSingleExternalIdentifierAndExtractValue(final List<ExternalIdentifierType> olExtId,
        final String sIdentScheme); static String createCompositePatientId(final String assigningAuthId, final String patientId); static String createCompositePatientIdFromAssertion(final UserType userInfo, final String patientId);  }
@Test public void testCreateActiveParticipant() { String userId = "test1"; String altUserId = "John"; String userName = "Thomas John Smith"; Boolean userIsReq = true; ActiveParticipant expResult = new ActiveParticipant(); expResult.setAlternativeUserID(altUserId); expResult.setUserID(userId); expResult.setUserName(userName); ActiveParticipant result = AuditDataTransformHelper.createActiveParticipant(userId, altUserId, userName, userIsReq); assertEquals(expResult.getAlternativeUserID(), result.getAlternativeUserID()); assertEquals(expResult.getUserID(), result.getUserID()); assertEquals(expResult.getUserName(), result.getUserName()); }