### Question:
XMLBuilder { public XMLBuilder addElement(final String name, final Map<String, String> attributes, final String text) { startElement(name, attributes); if (StringUtils.isNotEmpty(text)) { builder.append(text); emptyElementInProgress = false; } return endElement(); }  static int getAttributesLength(final Map<String, String> attributes); static int getBasicElementLength(final String name); static int getBasicElementLength(final String name, final Map<String, String> attributes); XMLBuilder startElement(final String name, final Map<String, String> attributes); XMLBuilder startElement(final String name); XMLBuilder endElement(); XMLBuilder addElement(final String name, final Map<String, String> attributes, final String text); XMLBuilder addElement(final String name, final Map<String, String> attributes); XMLBuilder addElement(final String name, final String text); XMLBuilder addElement(final String name); @Override String toString(); static final String XML_VERSION; }### Answer:
@Test public void addElementWithAttributesAndEmptyText() { builder.addElement("x", attributes, StringUtils.EMPTY); test("<x a=\"0\" />"); }
@Test public void addElementWithAttributesAndText() { builder.addElement("x", attributes, "text"); test("<x a=\"0\">text</x>"); }
@Test public void addElementWithText() { builder.addElement("x", "text"); test("<x>text</x>"); }