View Javadoc

1   /*
2    * $Id: JXPathExpressionTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.xml.functional;
12  
13  import java.text.MessageFormat;
14  import java.util.Properties;
15  
16  
17  public class JXPathExpressionTestCase extends AbstractXmlPropertyExtractorTestCase
18  {
19  
20      public static final String MESSAGE = "<endpoint>{0}</endpoint>";
21  
22      public JXPathExpressionTestCase()
23      {
24          super(true);
25      }
26  
27      protected Properties getStartUpProperties()
28      {
29          Properties p = new Properties();
30          p.setProperty("selector.expression", "/endpoint");
31          p.setProperty("selector.evaluator", "jxpath");
32  
33          return p;
34      }
35  
36      protected Object getMatchMessage() throws Exception
37      {
38          return documentFor("matchingEndpoint1");
39      }
40  
41      protected Object getErrorMessage() throws Exception
42      {
43          return documentFor("missingEndpoint");
44      }
45  
46      protected String documentFor(String name) throws Exception
47      {
48          return MessageFormat.format(MESSAGE, name);
49      }
50  
51  }