Package net.sf.gluent.doc.distillery.simplexmlbuilder.SimpleXml

Examples of net.sf.gluent.doc.distillery.simplexmlbuilder.SimpleXml.RootWithAutomaticEnd.body()


  }

  @Test
  public void testOneElementWithAutomaticEnd() {
    RootWithAutomaticEnd xml = SimpleXml.withAutomaticEnd().to(outWriter);
    ElementsWithAutomaticEnd elements = xml.body();
    elements.e("a").end();
    assertOut("<a/>");
  }

  @Test
View Full Code Here


  }

  @Test
  public void testOneElementWithAutomaticEndAndIncorrectEndTag() {
    RootWithAutomaticEnd xml = SimpleXml.withAutomaticEnd().to(outWriter);
    ElementsWithAutomaticEnd elements = xml.body();
    try {
      elements.e("a").end("incorrect");
      fail();
    } catch (IllegalStateException e) {
      // expected
View Full Code Here

  }

  @Test
  public void testNoMoreAttrForcesEndTagWithAutomaticEnd() {
    RootWithAutomaticEnd xml = SimpleXml.withAutomaticEnd().to(outWriter);
    ElementsWithAutomaticEnd elements = xml.body();
    elements.e("a").noMoreAttr().end();
    assertOut("<a></a>");
  }

  @Test
View Full Code Here

  }

  @Test
  public void testNoMoreAttrForcesEndTagWithAutomaticEndAndIncorrectEndTag() {
    RootWithAutomaticEnd xml = SimpleXml.withAutomaticEnd().to(outWriter);
    ElementsWithAutomaticEnd elements = xml.body();
    try {
      elements.e("a").noMoreAttr().end("incorrect");
      fail();
    } catch (IllegalStateException e) {
      // expected
View Full Code Here

  }

  @Test
  public void testSubElementsAndManyAttributesWithAutomaticEnd() {
    RootWithAutomaticEnd xml = SimpleXml.withAutomaticEnd().to(outWriter);
    ElementsWithAutomaticEnd elements = xml.body();
    elements.e("a").a("a1", "a1v").e("aa").end().e("ab").a("ab1", "ab1v")
        .a("ab2", "ab2v").end().end();
    assertOut("<a a1='a1v'><aa/><ab ab1='ab1v' ab2='ab2v'/></a>");
  }
View Full Code Here

  }

  @Test
  public void testTextAndAttributesAreEscapedWithAutomaticEnd() {
    RootWithAutomaticEnd xml = SimpleXml.withAutomaticEnd().to(outWriter);
    ElementsWithAutomaticEnd elements = xml.body();
    elements.e("a").a("a", "&").t("a&<b>\"'").e("b").noMoreAttr().t("&")
        .end("b").end("a");
    assertOut("<a a='&amp;'>a&amp;&lt;b&gt;&quot;&apos;<b>&amp;</b></a>");
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.