### Question:
ContentElement implements ExtensionElement { ContentElement(PayloadElement payload, List<AffixElement> affixElements) { this.payload = payload; this.affixElements = Collections.unmodifiableList(affixElements); } ContentElement(PayloadElement payload, List<AffixElement> affixElements); PayloadElement getPayload(); List<AffixElement> getAffixElements(); @Override String getNamespace(); @Override String getElementName(); @Override XmlStringBuilder toXML(XmlEnvironment xmlEnvironment); @Override QName getQName(); static Builder builder(); static final String NAMESPACE_0; static final String NAMESPACE; static final String ELEMENT; static final QName QNAME; }### Answer:
@Test public void testContentElement() throws ParseException { Message.Body body = new Message.Body("en", "My battery is low and it’s getting dark"); ContentElement contentElement = ContentElement.builder() .addPayloadItem(body) .setFrom(AffixElementsTest.JID_OPPORTUNITY) .addTo(AffixElementsTest.JID_HOUSTON) .setTimestamp(XmppDateTime.parseXEP0082Date("2018-06-10T00:00:00.000+00:00")) .setRandomPadding("RANDOMPADDING") .build(); String expectedXml = "" + "<content xmlns='urn:xmpp:sce:0'>" + " <to jid='missioncontrol@houston.nasa.gov'/>" + " <from jid='opportunity@mars.planet'/>" + " <time stamp='2018-06-10T00:00:00.000+00:00'/>" + " <rpad>RANDOMPADDING</rpad>" + " <payload>" + " <body xmlns='jabber:client' xml:lang='en'>My battery is low and it’s getting dark</body>" + " </payload>" + "</content>"; assertXmlSimilar(expectedXml, contentElement.toXML()); assertEquals(Collections.singletonList(body), contentElement.getPayload().getItems()); assertEquals(4, contentElement.getAffixElements().size()); assertTrue(contentElement.getAffixElements().contains(new ToAffixElement(AffixElementsTest.JID_HOUSTON))); assertTrue(contentElement.getAffixElements().contains(new FromAffixElement(AffixElementsTest.JID_OPPORTUNITY))); assertTrue(contentElement.getAffixElements().contains( new TimestampAffixElement(XmppDateTime.parseXEP0082Date("2018-06-10T00:00:00.000+00:00")))); assertTrue(contentElement.getAffixElements().contains(new RandomPaddingAffixElement("RANDOMPADDING"))); }