use of org.codice.ddf.parser.xml.domain.ChildElement in project ddf by codice.
the class TestXmlParser method testUnmarshalBadCast.
@Test
public void testUnmarshalBadCast() throws Exception {
ByteArrayOutputStream os = new ByteArrayOutputStream();
parser.marshal(configurator, mother, os);
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
thrown.expect(ClassCastException.class);
ChildElement unmarshal = parser.unmarshal(configurator, ChildElement.class, is);
}
use of org.codice.ddf.parser.xml.domain.ChildElement in project ddf by codice.
the class TestXmlParser method setUp.
@Before
public void setUp() throws Exception {
parser = new XmlParser();
List<String> ctxPath = ImmutableList.of(MotherElement.class.getPackage().getName());
configurator = parser.configureParser(ctxPath, TestXmlParser.class.getClassLoader());
mother = new MotherElement();
mother.setFirstname("Padme");
mother.setLastname("Skywalker");
mother.setAge(25);
luke = new ChildElement();
luke.setAge(2);
luke.setFirstname("Luke");
luke.setLastname("Skywalker");
leia = new ChildElement();
leia.setAge(2);
leia.setFirstname("Leia");
leia.setLastname("Organa");
mother.getChild().add(luke);
mother.getChild().add(leia);
}
Aggregations