RequestReplyProducerBase extends AdaptrisMessageProducerImp { protected void copyReplyContents(AdaptrisMessage reply, AdaptrisMessage original) throws ProduceException { try { MessageHelper.copyPayload(reply, original); } catch (Exception e) { throw ExceptionHelper.wrapProduceException(e); } }    }
@Test public void testCopyReplyContents() throws Exception { AdaptrisMessage reply = new DefaultMessageFactory().newMessage("hello world"); AdaptrisMessage original = new DefaultMessageFactory().newMessage(); copyReplyContents(reply, original); assertEquals("hello world", original.getContent()); }
@Test(expected = ProduceException.class) public void testCopyReplyContents_Failure() throws Exception { AdaptrisMessage reply = new DefectiveMessageFactory(WhenToBreak.BOTH).newMessage(); AdaptrisMessage original = new DefaultMessageFactory().newMessage(); copyReplyContents(reply, original); }
@Test public void testCopyReplyContents_BothFileBacked() throws Exception { AdaptrisMessage reply = new FileBackedMessageFactory().newMessage("hello world"); AdaptrisMessage original = new FileBackedMessageFactory().newMessage(); copyReplyContents(reply, original); assertEquals("hello world", original.getContent()); assertTrue(original.getObjectHeaders().containsKey(reply.getUniqueId())); }
@Test public void testCopyReplyContents_OneFileBacked() throws Exception { AdaptrisMessage reply = new FileBackedMessageFactory().newMessage("hello world"); AdaptrisMessage original = new DefaultMessageFactory().newMessage(); copyReplyContents(reply, original); assertEquals("hello world", original.getContent()); assertFalse(original.getObjectHeaders().containsKey(reply.getUniqueId())); }