public void testRar() throws Exception {
marshalAndUnmarshal(Connector.class, "connector-example.xml");
}
private <T> void marshalAndUnmarshal(Class<T> type, String xmlFileName) throws JAXBException, IOException {
JAXBContext ctx = JAXBContext.newInstance(type);
Unmarshaller unmarshaller = ctx.createUnmarshaller();
InputStream in = this.getClass().getClassLoader().getResourceAsStream(xmlFileName);
String expected = readContent(in);
Object object = unmarshaller.unmarshal(new ByteArrayInputStream(expected.getBytes()));
// JAXBElement element = (JAXBElement) object;
unmarshaller.setEventHandler(new TestValidationEventHandler());
// T app = (T) element.getValue();
// System.out.println("unmarshalled");
Marshaller marshaller = ctx.createMarshaller();
marshaller.setProperty("jaxb.formatted.output", true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
marshaller.marshal(object, baos);