コード例 #1
0
 @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();
 }
コード例 #2
0
 @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");
 }
コード例 #3
0
 @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");
 }
コード例 #4
0
  public void testSpin_XML_Available() {

    SpinXmlElement spinXmlEl = executeExpression("${ XML('" + xmlString + "') }");
    assertNotNull(spinXmlEl);
    assertEquals("elementName", spinXmlEl.name());
  }