### Question:
FixSession { public void prepareOutgoing(FixMessageBuilder fixMessage) { FixMessageHeader header = fixMessage.getHeader(); if (header.getBeginString() == null || "".equals(header.getBeginString())) { header.setBeginString(beginString); } if (header.getMsgSeqNum() == 0) { header.setMsgSeqNum(nextOutgoingMessageSeqNum.getAndIncrement()); } if (header.getSenderCompID() == null || "".equals(header.getSenderCompID())) { header.setSenderCompID(senderCompID); } if (header.getSenderSubID() == null || "".equals(header.getSenderSubID())) { header.setSenderSubID(senderSubID); } if (header.getSenderLocationID() == null || "".equals(header.getSenderLocationID())) { header.setSenderLocationID(senderLocationID); } if (header.getTargetCompID() == null || "".equals(header.getTargetCompID())) { header.setTargetCompID(targetCompID); } if (header.getTargetSubID() == null || "".equals(header.getTargetSubID())) { header.setTargetSubID(targetSubID); } if (header.getTargetLocationID() == null || "".equals(header.getTargetLocationID())) { header.setTargetLocationID(targetLocationID); } if (header.getDateTimeFormatter() == null) { header.setDateTimeFormatter(dateTimeFormatter); } } private  FixSession(Builder builder); static Builder newBuilder(); String getBeginString(); String getSenderCompID(); String getSenderSubID(); String getSenderLocationID(); String getTargetCompID(); String getTargetSubID(); String getTargetLocationID(); String getDefaultApplVerID(); String getDefaultApplExtID(); int getNextOutgoingMessageSeqNum(); void setNextOutgoingMessageSeqNum(int nextOutgoingMessageSeqNum); int getNextIncomingMessageSeqNum(); void setNextIncomingMessageSeqNum(int nextIncomingMessageSeqNum); int getNextOutgoingMsgSeqNum(); boolean checkAndIncrementIncomingSeqNum(final int num); DateTimeFormatterWrapper getDateTimeFormatter(); void setDateTimeFormatter(DateTimeFormatterWrapper dateTimeFormatter); void prepareOutgoing(FixMessageBuilder fixMessage); SessionId getId();  }### Answer:
@Test public void testPrepareOutgoing() { int nextOutgoingMsgSeqNum = new Random().nextInt(100) + 100; session.setNextOutgoingMessageSeqNum(nextOutgoingMsgSeqNum); FixMessageBuilder messageBuilder = new FixMessageBuilderImpl(); session.prepareOutgoing(messageBuilder); assertEquals(nextOutgoingMsgSeqNum + 1, session.getNextOutgoingMessageSeqNum()); final FixMessageHeader header = messageBuilder.getHeader(); assertEquals("nextOutgoingMsgSeqNum", nextOutgoingMsgSeqNum, header.getMsgSeqNum()); assertEquals("beginString", beginString, header.getBeginString()); assertEquals("senderCompID", senderCompID, header.getSenderCompID()); assertEquals("senderSubID", senderSubID, header.getSenderSubID()); assertEquals("senderLocationID", senderLocationID, header.getSenderLocationID()); assertEquals("targetCompID", targetCompID, header.getTargetCompID()); assertEquals("targetSubID", targetSubID, header.getTargetSubID()); assertEquals("targetLocationID", targetLocationID, header.getTargetLocationID()); }