use of testTypes.Root in project jdk8u_jdk by JetBrains.
the class UnmarshalTest method unmarshalUnexpectedNsTest.
@Test
public void unmarshalUnexpectedNsTest() throws Exception {
JAXBContext context;
Unmarshaller unm;
// Create JAXB context from testTypes package
context = JAXBContext.newInstance("testTypes");
// Create unmarshaller from JAXB context
unm = context.createUnmarshaller();
// Unmarshall xml document with unqualified dtime element
Root r = (Root) unm.unmarshal(new InputSource(new StringReader(DOC)));
// Print dtime value and check if it is null
System.out.println("dtime is:" + r.getWhen().getDtime());
assertNull(r.getWhen().getDtime());
}
Aggregations