ErrorReportAccess { public ErrorReport getErrorReport(Reader xml) { ErrorReport errorReport = null; try { InputSource inputSource = new InputSource(xml); JAXBContext context = JAXBContext.newInstance(ErrorReport.class); Unmarshaller unmarshaller = context.createUnmarshaller(); unmarshaller.setEventHandler(new ValidationEventHandler() { @SuppressWarnings("synthetic-access") public boolean handleEvent(ValidationEvent ve) { if (ve.getSeverity() != ValidationEvent.WARNING) { ValidationEventLocator vel = ve.getLocator(); LOGGER.warn("Line:Col[" + vel.getLineNumber() + ":" + vel.getColumnNumber() + "]:" + ve.getMessage()); } return true; } }); errorReport = (ErrorReport) unmarshaller.unmarshal(inputSource); } catch (JAXBException e) { LOGGER.error("Error parsing file", e); throw new RulesException("Failed reading file"); } return errorReport; }  ErrorReport getErrorReport(Reader xml); static String serialize(ErrorReport newRules);  }
@Test public void testCanRead() throws IOException { String xml = ResourcesUtil.getResourceAsString(this.getClass(), "ErrorReport1.xml"); StringReader sr = new StringReader(xml); ErrorReport er = errorReportAccess.getErrorReport(sr); assertNotNull(er.getOmissions()); assertNotNull(er.getBadInterventions()); }