226.4. assertPeriod の使用
Camel 2.7 以降で利用可能
アサーションが満たされると、Camel は待機を停止し、assertIsSatisfied メソッドから続行します。つまり、少し遅れて新しいメッセージがモックエンドポイントに到着した場合、その到着はアサーションの結果に影響しません。一定期間後に新しいメッセージが到着しないことをテストしたい場合は、setAssertPeriod メソッドを設定することでそれを行うことができます。次に例を示します。
MockEndpoint resultEndpoint = context.resolveEndpoint("mock:foo", MockEndpoint.class);
resultEndpoint.setAssertPeriod(5000);
resultEndpoint.expectedMessageCount(2);
// send some messages
// now lets assert that the mock:foo endpoint received 2 messages
resultEndpoint.assertIsSatisfied();