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