	@Test
	@DirtiesContext
	public void testJmsFailure() throws Exception {

		RouteDefinition routeDef = context.getRouteDefinition(
				FileIngestorRouteBuilder.ENQUEUE_RECORD_ROUTE_ID);
		
		routeDef.adviceWith(context, new RouteBuilder() {
			
			@Override
			public void configure() throws Exception {
					interceptSendToEndpoint(builder.getEnqueueRecordsDestinationUri())
						.choice()
							.when().xpath("/example:record/example:id[text() = '1']",
									FileIngestorRouteBuilder.NAMESPACES)
									.throwException(new JMSException("Simulated JMS Error!"))
							.end();
			}
		});
		
		context.start();
		
		DatatypeFactory dtf = DatatypeFactory.newInstance();
        
		Set<String> expectedIds = new HashSet<String>();
        AggregateRecordType agt = new AggregateRecordType();
        agt.setDate(dtf.newXMLGregorianCalendar(new GregorianCalendar()));
        
        output.setExpectedMessageCount(9);
        
        for (int i = 0; i < 10; i++) {
        	RecordType record = new RecordType();
        	record.setId(String.valueOf(i));
        	record.setDate(dtf.newXMLGregorianCalendar(new GregorianCalendar()));
        	record.setDescription("Record number: " + i);
        	agt.getRecord().add(record);
        	
        	if (i != 1) {
        		expectedIds.add(String.valueOf(i));
        	}
        }
        
        createAndMoveFile(agt);
        
        output.assertIsSatisfied();
        validateFileMove(true);
        
        for (Exchange exchange : output.getReceivedExchanges()) {
        	assertTrue(expectedIds.remove(exchange.getIn().getBody(RecordType.class).getId()));
        }
        
        assertTrue(expectedIds.isEmpty());
		
		
	}