@Test
  public void testAutoCreate() throws Exception {
    if (!canTest()) {
      return;
    }
    SftpEndpoint endpoint = (SftpEndpoint) this.getMandatoryEndpoint(getFtpUrl());
    endpoint.start();
    endpoint.getExchanges();
    assertTrue(new File(FTP_ROOT_DIR + "/foo/bar/baz/xxx").exists());
    // producer should create necessary subdirs
    template.sendBodyAndHeader(
        getFtpUrl(), "Hello World", Exchange.FILE_NAME, "sub1/sub2/hello.txt");
    assertTrue(new File(FTP_ROOT_DIR + "/foo/bar/baz/xxx/sub1/sub2").exists());

    // to see if another connect causes problems with autoCreate=true
    endpoint.stop();
    endpoint.start();
    endpoint.getExchanges();
  }
 @Test
 public void testNoAutoCreate() throws Exception {
   SftpEndpoint endpoint =
       (SftpEndpoint) this.getMandatoryEndpoint(getFtpUrl() + "&autoCreate=false");
   endpoint.start();
   try {
     endpoint.getExchanges();
     fail("Should fail with 550 No such directory.");
   } catch (GenericFileOperationFailedException ignored) {
     // ignore
   }
 }