boolean lastMessage;
if (outbound) {
SOAPElement se = getSequence(outboundMessages.get(i));
lastMessage = null == se ? false : getLastMessage(se);
} else {
SequenceType s = getSequence(inboundContexts.get(i));
lastMessage = null == s ? false : null != s.getLastMessage();
}
assertEquals("Outbound message " + i
+ (expectedLastMessages[i] ? " does not contain expected last message element."
: " contains last message element."),
expectedLastMessages[i], lastMessage);