@Test public void canReplaceRootElement() { SpinXmlElement root = XML("<root/>"); assertThat(element.name()).isEqualTo("customers"); assertThat(element.childElements()).isNotEmpty(); element = element.replace(root); assertThat(element.name()).isEqualTo("root"); assertThat(element.childElements()).isEmpty(); }
@Test public void canAppendChildElementAfterExistingElement() { SpinXmlElement child = XML("<child/>"); SpinXmlElement date = element.childElement("date"); element.appendAfter(child, date); SpinXmlElement insertedElement = element.childElements().get(1); assertThat(insertedElement.name()).isEqualTo("child"); }
@Test public void canAppendChildElementAfterLastChildElement() { SpinXmlElement child = XML("<child/>"); int childCount = element.childElements().size(); SpinXmlElement lastChildElement = element.childElements().get(childCount - 1); element.appendAfter(child, lastChildElement); SpinXmlElement insertedElement = element.childElements().get(childCount); assertThat(insertedElement.name()).isEqualTo("child"); }
public void testSpin_XML_Available() { SpinXmlElement spinXmlEl = executeExpression("${ XML('" + xmlString + "') }"); assertNotNull(spinXmlEl); assertEquals("elementName", spinXmlEl.name()); }