AsyncMessageProcessHelper { public AssertionType copyAssertionTypeObject(final AssertionType orig) { AssertionType copy = null; ByteArrayOutputStream baOutStrm = null; ByteArrayInputStream baInStrm = null; try { final JAXBUnmarshallingUtil util = new JAXBUnmarshallingUtil(); final JAXBContextHandler oHandler = new JAXBContextHandler(); final JAXBContext jc = oHandler.getJAXBContext("gov.hhs.fha.nhinc.common.nhinccommon"); final Marshaller marshaller = jc.createMarshaller(); baOutStrm = new ByteArrayOutputStream(); final gov.hhs.fha.nhinc.common.nhinccommon.ObjectFactory factory = new gov.hhs.fha.nhinc.common.nhinccommon.ObjectFactory(); final JAXBElement<AssertionType> oJaxbElement = factory.createAssertion(orig); marshaller.marshal(oJaxbElement, baOutStrm); final byte[] buffer = baOutStrm.toByteArray(); final Unmarshaller unmarshaller = jc.createUnmarshaller(); baInStrm = new ByteArrayInputStream(buffer); final JAXBElement<AssertionType> oJaxbElementCopy = (JAXBElement<AssertionType>) unmarshaller .unmarshal(util.getSafeStreamReaderFromInputStream(baInStrm)); copy = oJaxbElementCopy.getValue(); } catch (final JAXBException e) { LOG.error("Exception during copyAssertionTypeObject conversion :" + e, e); } catch (final XMLStreamException e) { LOG.error("Exception during copyAssertionTypeObject conversion :" + e, e); } finally { StreamUtils.closeReaderSilently(baOutStrm); StreamUtils.closeStreamSilently(baInStrm); } return copy; }  boolean addPatientDiscoveryRequest(final PRPAIN201305UV02 request, final AssertionType assertion,
            final String direction); boolean addPatientDiscoveryRequest(final RespondingGatewayPRPAIN201305UV02RequestType request,
            final String direction); boolean processAck(final String messageId, String newStatus, final String errorStatus,
            final MCCIIN000002UV01 ack); boolean processMessageStatus(final String messageId, final String newStatus); boolean processPatientDiscoveryResponse(final String messageId, String newStatus, final String errorStatus,
            final RespondingGatewayPRPAIN201306UV02RequestType response); AssertionType copyAssertionTypeObject(final AssertionType orig); String marshalAssertionTypeObject(final AssertionType assertion);  }
@Test public void testCopyAssertionTypeObject() { AssertionType origAssertion = new AssertionType(); origAssertion.setMessageId("1.1"); AsyncMessageProcessHelper asyncHelper = createAsyncMessageProcessHelper(); AssertionType copiedAssertion = asyncHelper.copyAssertionTypeObject(origAssertion); assertEquals("1.1", copiedAssertion.getMessageId()); }