### Question:
RetractedElement implements ExtensionElement { @Override public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) { return new XmlStringBuilder(this) .attribute(ATTR_STAMP, getStamp()) .rightAngleBracket() .append(getOriginId()) .closeElement(this); } RetractedElement(Date stamp, OriginIdElement originId); Date getStamp(); OriginIdElement getOriginId(); @Override String getNamespace(); @Override String getElementName(); @Override XmlStringBuilder toXML(XmlEnvironment xmlEnvironment); static final String ELEMENT; static final String ATTR_STAMP; }### Answer:
@Test public void serializationTest() throws ParseException { Date stamp = XmppDateTime.parseXEP0082Date("2019-09-20T23:08:25.000+00:00"); OriginIdElement originId = new OriginIdElement("origin-id-1"); RetractedElement retractedElement = new RetractedElement(stamp, originId); String expectedXml = "" + "<retracted stamp='2019-09-20T23:08:25.000+00:00' xmlns='urn:xmpp:message-retract:0'>\n" + " <origin-id xmlns='urn:xmpp:sid:0' id='origin-id-1'/>\n" + "</retracted>"; assertXmlSimilar(expectedXml, retractedElement.toXML()); }