public void testConvertToBytesCharsetFail() throws Exception {
    byte[] body = "Hello World".getBytes("utf-8");

    MockEndpoint result = getMockEndpoint("mock:result");
    result.expectedBodiesReceived(body);

    template.sendBody("direct:charset2", "Hello World");

    // should NOT be okay as we expected utf-8 but got it in utf-16
    result.assertIsNotSatisfied();
  }
  public void testCustomPolicy() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:result");
    mock.expectedBodiesReceived("Hello World");
    mock.setResultWaitTime(2000);

    template.sendBody("seda:foo", "Hello World");

    // wait 2 sec but the route is not started
    mock.assertIsNotSatisfied();

    // now start it using our policy
    policy.startRoute();

    // now the message should be routed
    mock.assertIsSatisfied();
  }
  public void testConvertToStringCharsetFail() throws Exception {

    // does not work on AIX
    String osName = System.getProperty("os.name").toLowerCase(Locale.US);
    boolean aix = osName.indexOf("aix") > -1;
    if (aix) {
      return;
    }

    String body = "Hell\u00F6 W\u00F6rld";

    MockEndpoint result = getMockEndpoint("mock:result");
    result.expectedBodiesReceived(body);

    template.sendBody("direct:charset3", new ByteArrayInputStream(body.getBytes("utf-8")));

    // should NOT be okay as we expected utf-8 but got it in utf-16
    result.assertIsNotSatisfied();
  }