### Question:
Message implements XmlAble, Cloneable { @Override public String toXmlString() { String response = ""; if (responseToId != null) { response = " responseTo=\"" + responseToId + "\""; } String sending = ""; if (sendingNodeId != null) { if (sendingNodeId instanceof Long || sendingNodeId instanceof NodeHandle) { try { sending = "\t<sendingNode encoding=\"base64\">" + SerializeTools.serializeToBase64(sendingNodeId) + "</sendingNode>\n"; } catch (SerializationException e) { } } } String base64ContentKey = ""; if (baContentKey != null) { base64ContentKey = Base64.getEncoder().encodeToString(baContentKey); } String receiver; String contentKey = ""; String encryption = ""; if (!isTopic()) { receiver = "to=\"" + recipientId + "\""; encryption = " encryption=\"" + CryptoTools.getSymmetricAlgorithm() + "\""; contentKey = "\t<contentKey encryption=\"" + CryptoTools.getAsymmetricAlgorithm() + "\" encoding=\"base64\">" + base64ContentKey + "</contentKey>\n"; } else { receiver = "topic=\"" + topicId + "\""; } String base64Signature = ""; if (baSignature != null) { base64Signature = Base64.getEncoder().encodeToString(baSignature); } return "<las2peer:message" + " id=\"" + id + "\"" + response + " from=\"" + senderId + "\" " + receiver + " generated=\"" + timestampMs + "\" timeout=\"" + validMs + "\">\n" + sending + "\t<content" + encryption + " encoding=\"base64\">" + Base64.getEncoder().encodeToString(baEncryptedContent) + "</content>\n" + contentKey + "\t<signature encoding=\"base64\" method=\"" + CryptoTools.getSignatureMethod() + "\">" + base64Signature + "</signature>\n" + "</las2peer:message>\n"; } Message();  Message(AgentImpl from, AgentImpl to, Serializable data);  Message(AgentImpl from, AgentImpl to, Serializable data, long timeOutMs);  Message(AgentImpl from, AgentImpl to, XmlAble data);  Message(AgentImpl from, AgentImpl to, XmlAble data, long timeoutMs);  Message(AgentImpl from, long topic, Serializable data);  Message(AgentImpl from, long topic, Serializable data, long timeoutMs);  Message(Message responseTo, XmlAble data, long timeoutMs);  Message(Message responseTo, XmlAble data);  Message(Message responseTo, Serializable data, long timeoutMs);  Message(Message responseTo, Serializable data); AgentImpl getSender(); String getSenderId(); AgentImpl getRecipient(); String getRecipientId(); Long getTopicId(); boolean isTopic(); long getId(); Long getResponseToId(); boolean isResponse(); Object getContent(); void open(AgentStorage storage); void open(AgentImpl unlockedRecipient, AgentStorage storage); void open(AgentImpl unlockedRecipient, AgentStorage storage, ClassLoader contentClsLoader); void verifySignature(); void close(); boolean isOpen(); long getValidMs(); long getTimestamp(); Date getTimestampDate(); Date getTimeoutDate(); long getTimeoutTs(); boolean isExpired(); @Override String toXmlString(); void setStateFromXml(String xml); void setSendingNodeId(NodeHandle handle); void setSendingNodeId(Long id); void setRecipientId(String id); void setSendingNodeId(Object id); Serializable getSendingNodeId(); static Message createFromXml(String xml); @Override Message clone(); static final long DEFAULT_TIMEOUT; }### Answer:
@Test public void testPrintMessage() { try { UserAgentImpl eve = MockAgentFactory.getEve(); UserAgentImpl adam = MockAgentFactory.getAdam(); eve.unlock("evespass"); Message m = new Message(eve, adam, "a simple content string"); String xml = m.toXmlString(); System.out.println("------ XML message output ------"); System.out.println(xml); System.out.println("------ / XML message output ------"); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.toString()); } }