### Question:
CollectingValidationEventHandler extends AbstractValidationEventHandler { @Nonnull @ReturnsMutableCopy public IErrorList getErrorList () { return m_aRWLock.readLockedGet (m_aErrors::getClone); } CollectingValidationEventHandler(); @Nonnull @ReturnsMutableCopy IErrorList getErrorList(); void forEachResourceError(@Nonnull final Consumer <? super IError> aConsumer); @Nonnull EChange clearResourceErrors(); @Override String toString();  }### Answer:
@Test public void testReadWrite () throws JAXBException { final JAXBContext aCtx = JAXBContextCache.getInstance ().getFromCache (MockJAXBArchive.class); final Unmarshaller um = aCtx.createUnmarshaller (); { final CollectingValidationEventHandler cveh = new CollectingValidationEventHandler (); um.setEventHandler (cveh.andThen (new LoggingValidationEventHandler ())); final JAXBElement <MockJAXBArchive> o = um.unmarshal (TransformSourceFactory.create (new FileSystemResource ("src/test/resources/xml/test-archive-01.xml")), MockJAXBArchive.class); assertNotNull (o); assertTrue (cveh.getErrorList ().isEmpty ()); } { final CollectingValidationEventHandler cveh = new CollectingValidationEventHandler (); um.setEventHandler (cveh); final JAXBElement <MockJAXBArchive> o = um.unmarshal (TransformSourceFactory.create (new FileSystemResource ("src/test/resources/xml/buildinfo.xml")), MockJAXBArchive.class); assertNotNull (o); assertFalse (cveh.getErrorList ().isEmpty ()); } { final CollectingValidationEventHandler cveh = new CollectingValidationEventHandler (); um.setEventHandler (cveh.andThen (new LoggingValidationEventHandler ())); final JAXBElement <MockJAXBArchive> o = um.unmarshal (TransformSourceFactory.create (new FileSystemResource ("src/test/resources/xml/test-archive-03.xml")), MockJAXBArchive.class); assertNotNull (o); assertEquals (1, cveh.getErrorList ().size ()); CommonsTestHelper.testToStringImplementation (cveh); } }