@SuppressWarnings("resource")
public void testReadRetryExceptionInListener() throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("org/springframework/batch/core/jsr/configuration/xml/RetryReadListenerListenerException.xml");
JobLauncher jobLauncher = context.getBean(JobLauncher.class);
JobExecution jobExecution = jobLauncher.run(context.getBean(Job.class), new JobParameters());
List<Throwable> failureExceptions = jobExecution.getAllFailureExceptions();
assertTrue("Failure exceptions must equal one", failureExceptions.size() == 1);
assertTrue("Failure exception must be of type RetryException", (failureExceptions.get(0) instanceof RetryException));
assertTrue("Exception cause must be of type BatchRuntimeException", (failureExceptions.get(0).getCause() instanceof BatchRuntimeException));