SoapMessageNameResolver implements MessageNameResolver { @Override public String resolve(final WilmaHttpEntity request, final ParameterList parameters) { String name; try { name = xmlTypeResolver.getValue(SOAP_TYPE_QUERY, request.getBody()); } catch (Exception e) { logger.debug("Invalid XPath expression: " + SOAP_TYPE_QUERY, e); name = ""; } return name; }  @Override String resolve(final WilmaHttpEntity request, final ParameterList parameters);  }
@Test public void testResolveShouldResolveEmtyStringWhenXpathCannotBeEvaluated() { given(request.getBody()).willReturn(SOAP_CONTENT); given(xmlTypeResolver.getValue(SOAP_TYPE_QUERY, SOAP_CONTENT)).willThrow(new RuntimeException()); String actual = underTest.resolve(request, parameters); assertEquals(actual, ""); }
@Test public void testResolveShouldReturnEvaluatedXpathQuery() { given(request.getBody()).willReturn(SOAP_CONTENT); given(xmlTypeResolver.getValue(SOAP_TYPE_QUERY, SOAP_CONTENT)).willReturn(EVALUATED_QUERY); String actual = underTest.resolve(request, parameters); assertEquals(actual, EVALUATED_QUERY); }