Package com.bansheeproject.xmlbuilder

Examples of com.bansheeproject.xmlbuilder.Parser.decode()


  @Test
  public void testSimpleUnmarshall() {
    String xml = "<stringValue>test</stringValue>";
   
    Parser parser = new Parser();
    Simple simple = (Simple)parser.decode(xml, Simple.class);
   
   
    Assert.assertNotNull(simple);
    Assert.assertEquals("test", simple.stringValue);
   
View Full Code Here


 
  @Test
  public void testUnmarshallWithPath() {
    String xml = "<complex><test>testValue</test></complex>";
    Parser parser = new Parser();
    ComplexWithPath complexWithPath = (ComplexWithPath)parser.decode(xml, ComplexWithPath.class);
   
    Assert.assertNotNull(complexWithPath);
    Assert.assertEquals("testValue", complexWithPath.test);
   
   
View Full Code Here

  }
  @Test
  public void testUnmarshallWithSpacedXML() {
    String xml = "<complex>\n\t<test>testValue</test>\n</complex>";
    Parser parser = new Parser();
    ComplexWithPath complexWithPath = (ComplexWithPath)parser.decode(xml, ComplexWithPath.class);
   
    Assert.assertNotNull(complexWithPath);
    Assert.assertEquals("testValue", complexWithPath.test);
   
  }
View Full Code Here

 
  @Test
  public void testRespectXMLSpaces() {
    String xml = "<complex>\n\t<test>testValue  \n</test>\n</complex>";
    Parser parser = new Parser();
    ComplexWithPath complexWithPath = (ComplexWithPath)parser.decode(xml, ComplexWithPath.class);
   
    Assert.assertNotNull(complexWithPath);
    Assert.assertEquals("testValue  \n", complexWithPath.test);
  }
 
View Full Code Here

  @Test
  public void testUnmarshallAttribute() {
    String xml = "<element attribute=\"attr\" />";
    Parser parser = new Parser();
   
    SimpleWithAttribute simple = (SimpleWithAttribute)parser.decode(xml, SimpleWithAttribute.class);
   
    Assert.assertNotNull(simple);
    Assert.assertEquals("attr", simple.attribute);
  }
 
View Full Code Here

  @Test
  public void testUnmarshallNested() {
    String xml = "<stringValue>string</stringValue>";
    Parser parser = new Parser();
   
    Complex complex = (Complex) parser.decode(xml, Complex.class);
   
    Assert.assertNotNull(complex);
    Assert.assertNotNull(complex.simple);
    Assert.assertEquals("string", complex.simple.stringValue);
   
View Full Code Here

  public void testNonsenseXML() {
   
    String nonsense = "fdskjssadsa";
   
    Parser parser = new Parser();
    parser.decode(nonsense, Simple.class);
   
  }

}
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.