@Test public void testUnmarshalError() { try { UnmarshalHelper.unmarshalError(file); fail("no exception thrown"); } catch (Exception e) { logger.error("MarshalException", e); assertTrue(e.toString().contains("unexpected element (uri:")); } }
public static Car unmarshalError(File file) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Car.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Car car = (Car) jaxbUnmarshaller.unmarshal(file); LOGGER.info(car.toString()); return car; }
UnmarshalHelper { public static Car unmarshalError(File file) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Car.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Car car = (Car) jaxbUnmarshaller.unmarshal(file); LOGGER.info(car.toString()); return car; } }
UnmarshalHelper { public static Car unmarshalError(File file) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Car.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Car car = (Car) jaxbUnmarshaller.unmarshal(file); LOGGER.info(car.toString()); return car; } private  UnmarshalHelper(); }
UnmarshalHelper { public static Car unmarshalError(File file) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Car.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Car car = (Car) jaxbUnmarshaller.unmarshal(file); LOGGER.info(car.toString()); return car; } private  UnmarshalHelper(); static Car unmarshalError(File file); static Car unmarshal(File file); }
UnmarshalHelper { public static Car unmarshalError(File file) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Car.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Car car = (Car) jaxbUnmarshaller.unmarshal(file); LOGGER.info(car.toString()); return car; } private  UnmarshalHelper(); static Car unmarshalError(File file); static Car unmarshal(File file);  }