title: Camel route test: Could not find a suitable setter for property:
body: <p>I have the next route with a bean for a searchTerm:</p>
  
  <pre><code>from( receiveProtocol+"://"+ipMailServer+"?username="+username+"&amp;password="+password+"&amp;"+options+"&amp;searchTerm=#allowedAddresses")
  </code></pre>
  
  <p>The search term bean is like a spam filter: only accepts emails that are sent from a list of senders:</p>
  
  <pre><code>@Component
  public class SpamFilter {
  
      @Value( "${spring.mailserver.spamfilter}")   String spamFilter; // Contains valid senders separated by comma.   
  
      @Bean
      public SearchTerm allowedAddresses() {
  
          String acceptedAddresses[]= spamFilter.split( ",");
          SearchTermBuilder build = new SearchTermBuilder();
  
          for ( int i= 0; i&lt;acceptedAddresses.length; i++)
              build= build.from( Op.or, acceptedAddresses[ i].trim());
  
          return build.build();
      }
  }
  </code></pre>
  
  <p>Everything works fine with the route and the search term. I created a unit test using Mockito that worked fine when the route did not contain the search term. I modified the test for mocking the search term, adding the next line:</p>
  
  <pre><code>@MockBean(name="allowedAddresses") SpamFilter spamFilter;
  </code></pre>
  
  <p>But I get the next exception:</p>
  
  <pre><code>org.apache.camel.FailedToCreateRouteException: Failed to create route Email: Route(Email)[[From[imap://localhost?username=info@informer.d... because of Failed to resolve endpoint: imap://localhost?closeFolder=false&amp;consumer.delay=10000&amp;delete=false&amp;disconnect=false&amp;password=informer&amp;peek=true&amp;searchTerm=%23allowedAddresses&amp;unseen=true&amp;username=info%40informer.dispocargo.com due to: Could not find a suitable setter for property: searchTerm as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: javax.mail.search.SearchTerm with value #allowedAddresses
  </code></pre>
  
  <p>I think I am missing mocking some method in my test, or maybe I am wrong. Any help would be appreciated, thanks.</p>