/**
 * 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.processor;

import org.apache.camel.ContextTestSupport;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;

/**
 * @version $Revision: 1.1 $
 */
public class XPathFilterTest extends ContextTestSupport {
    protected Endpoint<Exchange> startEndpoint;
    protected MockEndpoint resultEndpoint;
    protected String matchingBody = "<person name='James' city='London'/>";
    protected String notMatchingBody = "<person name='Hiram' city='Tampa'/>";

    public void testSendMatchingMessage() throws Exception {
        resultEndpoint.expectedMessageCount(1);

        sendBody("direct:start", matchingBody);

        resultEndpoint.assertIsSatisfied();
    }

    public void testSendNotMatchingMessage() throws Exception {
        resultEndpoint.expectedMessageCount(0);

        sendBody("direct:start", notMatchingBody);

        resultEndpoint.assertIsSatisfied();
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        startEndpoint = resolveMandatoryEndpoint("direct:start");
        resultEndpoint = getMockEndpoint("mock:result");
    }

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                // START SNIPPET: example
                from("direct:start").
                        filter().xpath("/person[@name='James']").
                        to("mock:result");
                // END SNIPPET: example
            }
        };
    }
}

@@ -906,149 +906,28 @@
 mel.
-Endpoint;%0Aimport org.apache.camel.Exchange;%0Aimport org.apache.camel.builder.RouteBuilder;%0Aimport org.apache.camel.component.mock.MockEndpoint
+builder.RouteBuilder
 ;%0A%0A/
@@ -1029,355 +1029,192 @@
    p
-rotected Endpoint%3CExchange%3E startEndpoint;%0A    protected MockEndpoint resultEndpoint;%0A    protected String matchingBody = %22%3Cperson name='James' city='London'/%3E%22;%0A    protected String notMatchingBody = %22%3Cperson name='Hiram' city='Tampa'/%3E%22;%0A%0A    public void testSendMatchingMessage() throws Exception %7B%0A        resultEndpoint.expectedMessageCount(1
+ublic void testSendMatchingMessage() throws Exception %7B%0A        String body = %22%3Cperson name='James' city='London'/%3E%22;%0A        getMockEndpoint(%22mock:result%22).expectedBodiesReceived(body
 );%0A%0A
@@ -1250,17 +1250,9 @@
 t%22, 
-matchingB
+b
 ody)
@@ -1266,38 +1266,34 @@
     
-resultEndpoint.assertI
+assertMockEndpoint
 sSatis
-f
 i
+f
 ed()
@@ -1377,100 +1377,60 @@
     
-resultEndpoint.expectedMessageCount(0);%0A%0A        sendBody(%22direct:start%22, notMatchingBody);%0A
+String body = %22%3Cperson name='Hiram' city='Tampa'/%3E%22;
 %0A   
@@ -1434,30 +1434,31 @@
         
-result
+getMock
 Endpoint
 .assertI
@@ -1453,169 +1453,66 @@
 oint
-.assertIsSatisfied();%0A    %7D%0A%0A    @Override%0A    protected void setUp() throws Exception %7B%0A        super.setUp();%0A%0A        startEndpoint = resolveMandatoryEndpoint
+(%22mock:result%22).expectedMessageCount(0);%0A%0A        sendBody
 (%22di
@@ -1522,27 +1522,34 @@
 t:start%22
+, body
 );%0A
+%0A
         
 resultEn
@@ -1544,54 +1544,37 @@
     
-resultEndpoint = getMockEndpoint(%22mock:result%22
+assertMockEndpointsSatisifed(
 );%0A 

tidied up the test case