title: Camel Testing - How to test a Processor from a FileConsumer/FTPConsumer?
body: <p>I have a camel route which polls the files from a ftp server and send files to s3. I have some processors in the route which calculates/manipulates the headers based on file name. I need to test this route, How can i inject my processor and use the file language inside my processor?</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class CamelS3HeadersProcessorTest extends CamelTestSupport {
    private String filePath = "src/test/resources/sample.txt";
  
   // @Autowired
  //  private CamelS3HeadersProcessor camelS3HeadersProcessor;
  
    @Test
    public void shouldSetS3HeadersProperly() throws Exception {
      File file = new File(filePath);
      template.sendBody("direct:start", file);
      getMockEndpoint("mock:result").expectedMessageCount(1);
      getMockEndpoint("mock:result").expectedHeaderReceived(S3Constants.KEY, file.getName());
      assertMockEndpointsSatisfied();
    }
  
    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
      return new RouteBuilder() {
          @Override
          public void configure() throws Exception {
              from("direct:start").process(new CamelS3HeadersProcessor()).to("mock:result");
          }
      };
    }
  }
  </code></pre>
  
  <p>Processor:</p>
  
  <pre><code>@Component
  public class CamelS3HeadersProcessor implements Processor {
    @Override
    public void process(Exchange exchange) throws Exception {
      SimpleBuilder simpleBuilder = new SimpleBuilder("${file:name}");
      String fileName = simpleBuilder.evaluate(exchange, String.class);
      //do some logic and set headers
    }
  }
  </code></pre>
  
  <p>I don't want to mock my processor. I want to mock my endpoints and test my processor. </p>
  
  <p><strong>Problems:</strong></p>
  
  <ol>
  <li><p>Cannot Autowire/Inject my processor.</p></li>
  <li><p>File name was evaluated as null. How to use FileConsumer/FTPConsumer instead of ProducerTemplate?</p></li>
  </ol>