Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 70969 invoked from network); 24 Apr 2007 11:34:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2007 11:34:54 -0000 Received: (qmail 35405 invoked by uid 500); 24 Apr 2007 11:35:01 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 35380 invoked by uid 500); 24 Apr 2007 11:35:01 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 35371 invoked by uid 99); 24 Apr 2007 11:35:01 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 04:35:01 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 04:34:53 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 29F181A9838; Tue, 24 Apr 2007 04:34:33 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r531883 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/builder/ test/java/org/apache/camel/ test/java/org/apache/camel/builder/ Date: Tue, 24 Apr 2007 11:34:32 -0000 To: commits@activemq.apache.org From: jstrachan@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070424113433.29F181A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jstrachan Date: Tue Apr 24 04:34:31 2007 New Revision: 531883 URL: http://svn.apache.org/viewvc?view=rev&rev=531883 Log: some refactorings to make it easier to create expressions & predicates outside of the routing DSL for testing Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java (with props) Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/PredicateBuilderTest.java Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java?view=auto&rev=531883 ============================================================================== --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java (added) +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java Tue Apr 24 04:34:31 2007 @@ -0,0 +1,95 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.builder; + +import org.apache.camel.Exchange; +import org.apache.camel.Expression; + +/** + * A helper class for including portions of the + * expression and + * predicate + * Java DSL + * + * @version $Revision: 1.1 $ + */ +public class Builder { + + /** + * Returns a constant expression + */ + public static ValueBuilder constant(Object value) { + Expression expression = ExpressionBuilder.constantExpression(value); + return new ValueBuilder(expression); + } + + /** + * Returns a predicate and value builder for headers on an exchange + */ + public static ValueBuilder header(@FluentArg("name") String name) { + Expression expression = ExpressionBuilder.headerExpression(name); + return new ValueBuilder(expression); + } + + /** + * Returns a predicate and value builder for the inbound body on an exchange + */ + public static ValueBuilder body() { + Expression expression = ExpressionBuilder.bodyExpression(); + return new ValueBuilder(expression); + } + + /** + * Returns a predicate and value builder for the inbound message body as a specific type + */ + public static ValueBuilder bodyAs( Class type) { + Expression expression = ExpressionBuilder.bodyExpression(type); + return new ValueBuilder(expression); + } + + /** + * Returns a predicate and value builder for the outbound body on an exchange + */ + public static ValueBuilder outBody() { + Expression expression = ExpressionBuilder.bodyExpression(); + return new ValueBuilder(expression); + } + + /** + * Returns a predicate and value builder for the outbound message body as a specific type + */ + public static ValueBuilder outBody(Class type) { + Expression expression = ExpressionBuilder.bodyExpression(type); + return new ValueBuilder(expression); + } + + + /** + * Returns an expression for the given system property + */ + public static ValueBuilder systemProperty(final String name) { + return systemProperty(name, null); + } + + /** + * Returns an expression for the given system property + */ + public static ValueBuilder systemProperty(final String name, final String defaultValue) { + return new ValueBuilder(ExpressionBuilder.systemProperty(name, defaultValue)); + } +} Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Builder.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java?view=diff&rev=531883&r1=531882&r2=531883 ============================================================================== --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java (original) +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java Tue Apr 24 04:34:31 2007 @@ -16,20 +16,20 @@ */ package org.apache.camel.builder; -import java.util.ArrayList; -import java.util.List; - import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.Exchange; -import org.apache.camel.Expression; import org.apache.camel.processor.LoggingLevel; import org.apache.camel.processor.SendProcessor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.util.ArrayList; +import java.util.List; + /** - * Base class for implementation inheritance + * Base class for implementation inheritance for different clauses in the + * Java DSL * * @version $Revision: $ */ @@ -50,87 +50,96 @@ } } - // Helper methods + // Builder methods //------------------------------------------------------------------------- /** - * Resolves the given URI to an endpoint + * Returns a value builder for the given header */ @Fluent - public Endpoint endpoint(@FluentArg("uri") String uri) { - return getContext().resolveEndpoint(uri); + public ValueBuilder header(@FluentArg("name")String name) { + return Builder.header(name); } /** - * Resolves the list of URIs into a list of {@link Endpoint} instances + * Returns a predicate and value builder for the inbound body on an exchange */ @Fluent - public List> endpoints(@FluentArg("uris") String... uris) { - List> endpoints = new ArrayList>(); - for (String uri : uris) { - endpoints.add(endpoint(uri)); - } - return endpoints; + public ValueBuilder body() { + return Builder.body(); } /** - * Helper method to create a list of {@link Endpoint} instances + * Returns a predicate and value builder for the inbound message body as a specific type */ @Fluent - public List> endpoints(@FluentArg("endpoints") Endpoint... endpoints) { - List> answer = new ArrayList>(); - for (Endpoint endpoint : endpoints) { - answer.add(endpoint); - } - return answer; + public ValueBuilder bodyAs(@FluentArg("class")Class type) { + return Builder.bodyAs(type); } - // Builder methods - //------------------------------------------------------------------------- + /** + * Returns a predicate and value builder for the outbound body on an exchange + */ + @Fluent + public ValueBuilder outBody() { + return Builder.outBody(); + } /** - * Returns a predicate and value builder for headers on an exchange + * Returns a predicate and value builder for the outbound message body as a specific type */ @Fluent - public ValueBuilder header(@FluentArg("name") String name) { - Expression expression = ExpressionBuilder.headerExpression(name); - return new ValueBuilder(expression); + public ValueBuilder outBody(@FluentArg("class")Class type) { + return Builder.outBody(type); } /** - * Returns a predicate and value builder for the inbound body on an exchange + * Returns a value builder for the given system property */ @Fluent - public ValueBuilder body() { - Expression expression = ExpressionBuilder.bodyExpression(); - return new ValueBuilder(expression); + public ValueBuilder systemProperty(@FluentArg("name")String name) { + return Builder.systemProperty(name); } /** - * Returns a predicate and value builder for the inbound message body as a specific type + * Returns a value builder for the given system property */ @Fluent - public ValueBuilder bodyAs(@FluentArg("class") Class type) { - Expression expression = ExpressionBuilder.bodyExpression(type); - return new ValueBuilder(expression); + public ValueBuilder systemProperty( + @FluentArg("name")String name, @FluentArg("defaultValue")String defaultValue) { + return Builder.systemProperty(name, defaultValue); } /** - * Returns a predicate and value builder for the outbound body on an exchange + * Resolves the given URI to an endpoint */ @Fluent - public ValueBuilder outBody() { - Expression expression = ExpressionBuilder.bodyExpression(); - return new ValueBuilder(expression); + public Endpoint endpoint(@FluentArg("uri")String uri) { + return getContext().resolveEndpoint(uri); } /** - * Returns a predicate and value builder for the outbound message body as a specific type + * Resolves the list of URIs into a list of {@link Endpoint} instances */ @Fluent - public ValueBuilder outBody(@FluentArg("class") Class type) { - Expression expression = ExpressionBuilder.bodyExpression(type); - return new ValueBuilder(expression); + public List> endpoints(@FluentArg("uris")String... uris) { + List> endpoints = new ArrayList>(); + for (String uri : uris) { + endpoints.add(endpoint(uri)); + } + return endpoints; + } + + /** + * Helper method to create a list of {@link Endpoint} instances + */ + @Fluent + public List> endpoints(@FluentArg("endpoints")Endpoint... endpoints) { + List> answer = new ArrayList>(); + for (Endpoint endpoint : endpoints) { + answer.add(endpoint); + } + return answer; } /** @@ -153,7 +162,7 @@ * Creates an error handler which just logs errors */ @Fluent - public LoggingErrorHandlerBuilder loggingErrorHandler(@FluentArg("log") String log) { + public LoggingErrorHandlerBuilder loggingErrorHandler(@FluentArg("log")String log) { return loggingErrorHandler(LogFactory.getLog(log)); } @@ -161,7 +170,7 @@ * Creates an error handler which just logs errors */ @Fluent - public LoggingErrorHandlerBuilder loggingErrorHandler(@FluentArg("log") Log log) { + public LoggingErrorHandlerBuilder loggingErrorHandler(@FluentArg("log")Log log) { return new LoggingErrorHandlerBuilder(log); } @@ -169,7 +178,8 @@ * Creates an error handler which just logs errors */ @Fluent - public LoggingErrorHandlerBuilder loggingErrorHandler(@FluentArg("log") Log log, @FluentArg("level") LoggingLevel level) { + public LoggingErrorHandlerBuilder loggingErrorHandler( + @FluentArg("log")Log log, @FluentArg("level")LoggingLevel level) { return new LoggingErrorHandlerBuilder(log, level); } @@ -179,12 +189,12 @@ } @Fluent - public DeadLetterChannelBuilder deadLetterChannel(@FluentArg("uri") String deadLetterUri) { + public DeadLetterChannelBuilder deadLetterChannel(@FluentArg("uri")String deadLetterUri) { return deadLetterChannel(endpoint(deadLetterUri)); } @Fluent - public DeadLetterChannelBuilder deadLetterChannel(@FluentArg("endpoint") Endpoint deadLetterEndpoint) { + public DeadLetterChannelBuilder deadLetterChannel(@FluentArg("endpoint")Endpoint deadLetterEndpoint) { return new DeadLetterChannelBuilder(new SendProcessor(deadLetterEndpoint)); } Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java?view=diff&rev=531883&r1=531882&r2=531883 ============================================================================== --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java (original) +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java Tue Apr 24 04:34:31 2007 @@ -162,11 +162,11 @@ } public static Predicate isNull(final Expression expression) { - return isEqualTo(expression, (Expression) ExpressionBuilder.constantExpression(null)); + return isEqualTo(expression, ExpressionBuilder.constantExpression(null)); } public static Predicate isNotNull(final Expression expression) { - return isNotEqualTo(expression, (Expression) ExpressionBuilder.constantExpression(null)); + return isNotEqualTo(expression, ExpressionBuilder.constantExpression(null)); } public static Predicate isInstanceOf(final Expression expression, final Class type) { Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java?view=diff&rev=531883&r1=531882&r2=531883 ============================================================================== --- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java (original) +++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java Tue Apr 24 04:34:31 2007 @@ -31,59 +31,61 @@ public ValueBuilder(Expression expression) { this.expression = expression; } - + public Expression getExpression() { return expression; } - public Expression createExpression() { return expression; } + // Predicate builders + //------------------------------------------------------------------------- + @Fluent - public Predicate isNotEqualTo(@FluentArg("value") Object value) { - Expression right = ExpressionBuilder.constantExpression(value); + public Predicate isNotEqualTo(@FluentArg("value")Object value) { + Expression right = asExpression(value); return onNewPredicate(PredicateBuilder.isNotEqualTo(expression, right)); } @Fluent - public Predicate isEqualTo(@FluentArg("value") Object value) { - Expression right = ExpressionBuilder.constantExpression(value); + public Predicate isEqualTo(@FluentArg("value")Object value) { + Expression right = asExpression(value); return onNewPredicate(PredicateBuilder.isEqualTo(expression, right)); } @Fluent - public Predicate isLessThan(@FluentArg("value") Object value) { - Expression right = ExpressionBuilder.constantExpression(value); + public Predicate isLessThan(@FluentArg("value")Object value) { + Expression right = asExpression(value); return onNewPredicate(PredicateBuilder.isLessThan(expression, right)); } @Fluent - public Predicate isLessThanOrEqualTo(@FluentArg("value") Object value) { - Expression right = ExpressionBuilder.constantExpression(value); + public Predicate isLessThanOrEqualTo(@FluentArg("value")Object value) { + Expression right = asExpression(value); return onNewPredicate(PredicateBuilder.isLessThanOrEqualTo(expression, right)); } @Fluent - public Predicate isGreaterThan(@FluentArg("value") Object value) { - Expression right = ExpressionBuilder.constantExpression(value); + public Predicate isGreaterThan(@FluentArg("value")Object value) { + Expression right = asExpression(value); return onNewPredicate(PredicateBuilder.isGreaterThan(expression, right)); } @Fluent - public Predicate isGreaterThanOrEqualTo(@FluentArg("value") Object value) { - Expression right = ExpressionBuilder.constantExpression(value); + public Predicate isGreaterThanOrEqualTo(@FluentArg("value")Object value) { + Expression right = asExpression(value); return onNewPredicate(PredicateBuilder.isGreaterThanOrEqualTo(expression, right)); } @Fluent - public Predicate isInstanceOf(@FluentArg("class") Class type) { + public Predicate isInstanceOf(@FluentArg("class")Class type) { return onNewPredicate(PredicateBuilder.isInstanceOf(expression, type)); } @Fluent - public Predicate matchesRegex(@FluentArg("regex") String regex) { + public Predicate matchesRegex(@FluentArg("regex")String regex) { return onNewPredicate(PredicateBuilder.regex(expression, regex)); } @@ -97,25 +99,68 @@ return onNewPredicate(PredicateBuilder.isNotNull(expression)); } + /** + * Creates a predicate which is true if this expression matches the given regular expression + * + * @param regex the regular expression to match + * @return a predicate which evaluates to true if the expression matches the regex + */ + @Fluent + public Predicate regex(String regex) { + return onNewPredicate(PredicateBuilder.regex(expression, regex)); + } + + + // Transformers + //------------------------------------------------------------------------- + @Fluent public ValueBuilder tokenize() { return tokenize("\n"); } @Fluent - public ValueBuilder tokenize(@FluentArg("token") String token) { + public ValueBuilder tokenize(@FluentArg("token")String token) { Expression newExp = ExpressionBuilder.tokenizeExpression(expression, token); return new ValueBuilder(newExp); } /** + * Tokenizes the string conversion of this expression using the given regular expression + */ + @Fluent + public ValueBuilder regexTokenize(@FluentArg("regex")String regex) { + Expression newExp = ExpressionBuilder.regexTokenize(expression, regex); + return new ValueBuilder(newExp); + } + + /** + * Replaces all occurrencies of the regular expression with the given replacement + */ + @Fluent + public ValueBuilder regexReplaceAll(@FluentArg("regex")String regex, @FluentArg("replacement")String replacement) { + Expression newExp = ExpressionBuilder.regexReplaceAll(expression, regex, replacement); + return new ValueBuilder(newExp); + } + + /** + * Replaces all occurrencies of the regular expression with the given replacement + */ + @Fluent + public ValueBuilder regexReplaceAll(@FluentArg("regex")String regex, @FluentArg("replacement")Expression replacement) { + Expression newExp = ExpressionBuilder.regexReplaceAll(expression, regex, replacement); + return new ValueBuilder(newExp); + } + + + /** * Converts the current value to the given type using the registered type converters * * @param type the type to convert the value to * @return the current builder */ @Fluent - public ValueBuilder convertTo(@FluentArg("type") Class type) { + public ValueBuilder convertTo(@FluentArg("type")Class type) { Expression newExp = ExpressionBuilder.convertTo(expression, type); return new ValueBuilder(newExp); } @@ -130,6 +175,10 @@ return convertTo(String.class); } + + // Implementation methods + //------------------------------------------------------------------------- + /** * A stategy method to allow derived classes to deal with the newly created predicate * in different ways @@ -137,4 +186,18 @@ protected Predicate onNewPredicate(Predicate predicate) { return predicate; } + + protected Expression asExpression(Object value) { + if (value instanceof Expression) { + return (Expression) value; + } + else if (value instanceof ExpressionFactory) { + ExpressionFactory expressionFactory = (ExpressionFactory) value; + return expressionFactory.createExpression(); + } + else { + return ExpressionBuilder.constantExpression(value); + } + } + } Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java?view=diff&rev=531883&r1=531882&r2=531883 ============================================================================== --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java (original) +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/TestSupport.java Tue Apr 24 04:34:31 2007 @@ -76,12 +76,35 @@ /** * Asserts that the predicate returns the expected value on the exchange */ - protected boolean assertPredicate(Predicate expression, Exchange exchange, boolean expected) { - boolean value = expression.matches(exchange); + protected void assertPredicateMatches(Predicate predicate, Exchange exchange) { + assertPredicate(predicate, exchange, true); + } - log.debug("Evaluated predicate: " + expression + " on exchange: " + exchange + " result: " + value); + /** + * Asserts that the predicate returns the expected value on the exchange + */ + protected void assertPredicateDoesNotMatch(Predicate predicate, Exchange exchange) { + try { + predicate.assertMatches("Predicate should match", exchange); + } + catch (AssertionError e) { + log.debug("Caught expected assertion error: " + e); + } + assertPredicate(predicate, exchange, false); + } - assertEquals("Predicate: " + expression + " on Exchange: " + exchange, expected, value); + /** + * Asserts that the predicate returns the expected value on the exchange + */ + protected boolean assertPredicate(Predicate predicate, Exchange exchange, boolean expected) { + if (expected) { + predicate.assertMatches("Predicate failed", exchange); + } + boolean value = predicate.matches(exchange); + + log.debug("Evaluated predicate: " + predicate + " on exchange: " + exchange + " result: " + value); + + assertEquals("Predicate: " + predicate + " on Exchange: " + exchange, expected, value); return value; } Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/PredicateBuilderTest.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/PredicateBuilderTest.java?view=diff&rev=531883&r1=531882&r2=531883 ============================================================================== --- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/PredicateBuilderTest.java (original) +++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/PredicateBuilderTest.java Tue Apr 24 04:34:31 2007 @@ -17,16 +17,13 @@ */ package org.apache.camel.builder; -import org.apache.camel.TestSupport; import org.apache.camel.Exchange; -import org.apache.camel.Expression; -import org.apache.camel.Predicate; import org.apache.camel.Message; -import static org.apache.camel.builder.PredicateBuilder.*; -import org.apache.camel.impl.DefaultExchange; +import org.apache.camel.Predicate; +import org.apache.camel.TestSupport; +import static org.apache.camel.builder.Builder.*; import org.apache.camel.impl.DefaultCamelContext; - -import java.util.Arrays; +import org.apache.camel.impl.DefaultExchange; /** * @version $Revision$ @@ -34,14 +31,18 @@ public class PredicateBuilderTest extends TestSupport { protected Exchange exchange = new DefaultExchange(new DefaultCamelContext()); - public void testRegexTokenize() throws Exception { - Expression locationHeader = ExpressionBuilder.headerExpression("location"); + public void testRegexPredicates() throws Exception { + assertMatches(header("location").regex("[a-zA-Z]+,London,UK")); + assertDoesNotMatch(header("location").regex("[a-zA-Z]+,Westminster,[a-zA-Z]+")); + } - Predicate predicate = regex(locationHeader, "[a-zA-Z]+,London,UK"); - assertPredicate(predicate, exchange, true); + public void testPredicates() throws Exception { + assertMatches(header("name").isEqualTo(constant("James"))); + } - predicate = regex(locationHeader, "[a-zA-Z]+,Westminster,[a-zA-Z]+"); - assertPredicate(predicate, exchange, false); + public void testFailingPredicates() throws Exception { + assertDoesNotMatch(header("name").isEqualTo(constant("Hiram"))); + assertDoesNotMatch(header("size").isGreaterThan(constant(100))); } @Override @@ -51,5 +52,15 @@ in.setBody("Hello there!"); in.setHeader("name", "James"); in.setHeader("location", "Islington,London,UK"); + in.setHeader("size", 10); + } + + protected void assertMatches(Predicate predicate) { + assertPredicateMatches(predicate, exchange); } + + protected void assertDoesNotMatch(Predicate predicate) { + assertPredicateDoesNotMatch(predicate, exchange); + } + }