Hi guys,
I wanted to move my Xpath/JDOM codes out of my endpoint and to unit test them.


Code:
private XPathExpression<Element> cusIdExpression;
Code:
Namespace namespace = Namespace.getNamespace("etc", NAMESPACE_URI);
XPathFactory xPathFactory = XPathFactory.instance();
cusIdExpression = xPathFactory.compile("//etc:cusId", Filters.element(), null, namespace);
Code:
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "method1Request")
@ResponsePayload
@Transactional(readOnly=true)
public SearchCustomerResponse method1(@RequestPayload Element customerSearchOptions)
Long cusId = Long.parseLong(cusIdExpression.evaluateFirst(customerSearchOptions).getText());
However I am having difficulty to understand how I should be constructing the @RequestPayload Element customerSearchOptions to input to the unit test.

When I logged the to customerSearchOptions the console, I only found the line below logged

[Element: <ns:method1Request [Namespace: http://www.etc.com/etc/schemas/1/00]/>]
and the input XML which I was expecting was not there (i.e, the one being sent from SOAP UI)

Code:
   <soapenv:Body>
      <ns:method1>
         <ns:cusId>?</ns:cusId>
         <ns:locationCriteria>
            <ns:addressLine1>flacq</ns:addressLine1>
            <ns:city>?</ns:city>
            <ns:postCode>?</ns:postCode>
            <ns:isoCountryCode>Mauritius</ns:isoCountryCode>

If anyone knows how to actually contruct an input which could be used to unit test the XPath Expressions, I would appreciate if you could share it.

Code:
public void testCustomerId() {
		
		Element customerSearchOptions = new Element("");
		customerSearchServicePathExpressionParser.getCusId(customerSearchOptions);
		
	}
Also, if there is also a document which is published. Thanks for sharing that as well.

Regards
Kris