@Test
  public void canReplaceAChildElement() {
    SpinXmlElement child = XML("<child/>");
    SpinXmlElement date = element.childElement("date");
    assertThat(date).isNotNull();

    element.replaceChild(date, child);

    assertThat(element.childElement(null, "child")).isNotNull();
    try {
      element.childElement("date");
    } catch (Exception e) {
      assertThat(e).isInstanceOf(SpinXmlElementException.class);
    }
  }
 @Test(expected = SpinXmlElementException.class)
 public void cannotReplaceANonChildElement() {
   SpinXmlElement child = XML("<child/>");
   SpinXmlElement nonChild = XML("<child/>");
   element.replaceChild(nonChild, child);
 }
 @Test(expected = IllegalArgumentException.class)
 public void cannotReplaceByANullChildElement() {
   SpinXmlElement date = element.childElement("date");
   element.replaceChild(date, null);
 }
 @Test(expected = IllegalArgumentException.class)
 public void cannotReplaceANullChildElement() {
   SpinXmlElement child = XML("<child/>");
   element.replaceChild(null, child);
 }