title: Unit testing FTP consumer with Apache Camel
body: <p>I have the below route. In unit test, since I doesn't have the FTP server available, I'd like to use camel's test support and send an invalid message to <code>"ftp://hostname/input"</code> and verify that it failed and routed to <code>"ftp://hostname/error"</code>. </p>
  
  <p>I gone through the documentation which mainly talks about using the "mock:" endpoint but I am not sure how to use it in this scenario. </p>
  
  <pre><code>public class MyRoute extends RouteBuilder
  {
      @Override
      public void configure()
      {
          onException(EdiOrderParsingException.class).handled(true).to("ftp://hostname/error");
  
          from("ftp://hostname/input")
              .bean(new OrderEdiTocXml())
              .convertBodyTo(String.class)
              .convertBodyTo(Document.class)
              .choice()
              .when(xpath("/cXML/Response/Status/@text='OK'"))
              .to("ftp://hostname/valid").otherwise()
              .to("ftp://hostname/invalid");
      }
  }
  </code></pre>