You can use the dead letter channel to move the failed message to a mock:dead endpoint which you can use in unit tests.
On Fri, Sep 11, 2009 at 2:06 PM, Charles Moulliard <[email protected]> wrote: > Hi, > > I develop a unit to detect if an error has been raised during the parsing of > a file through Camel-bindy. In this unit test, I don't use a template to > produce message as they will be generated by the file endpoint. > > try { > // cannot be used as we work with a fileEndpoint --> > template.sendBody("direct:start", ""); > fail("Exception has been throwed"); > } catch (CamelExecutionException ex) { > ... > } > > > How can I check the error generated during file parsing (camel-bindy) ? > > Here is the route > > from(uriFile).unmarshal(oinpDataFormat).to(uriMockResult); > > Error to be catched : > > 2009-09-11 13:53:48,308 DEBUG GenericFileOnCompletion - Done processing > file: GenericFile[OINP_Example-bad_date_format.csv] using exchange: > Exchange[GenericFileMessage with file: > GenericFile[OINP_Example-bad_date_format.csv]] > 2009-09-11 13:53:48,308 ERROR GenericFileOnCompletion - Date provided does > not fit the pattern defined, position : 43, line nber : 1 > java.lang.IllegalArgumentException: Date provided does not fit the pattern > defined, position : 43, line nber : 1 > > > Charles Moulliard > Senior Enterprise Architect > Apache Camel Committer > > ***************************** > blog : http://cmoulliard.blogspot.com > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
