RestUrlMappingMessageNameResolver implements MessageNameResolver { @Override public String resolve(final WilmaHttpEntity entity, final ParameterList parameters) { String resolvedName; if (entity instanceof WilmaHttpRequest) { resolvedName = resolveRequest(entity, parameters); } else { resolvedName = EMPTY; } return resolvedName; }  @Override String resolve(final WilmaHttpEntity entity, final ParameterList parameters);  }
@Test public void testResolveShouldNotResolveWithoutType() throws Exception { givenRequestWithUrl("www.typeless.com/urls/resolvable.html"); String resolvedType = underTest.resolve(request, parameters); assertEquals(resolvedType, ""); }
@Test public void testResolveShouldNotResolveWithoutUrl() throws Exception { givenRequestWithUrl("not_an_url"); String resolvedType = underTest.resolve(request, parameters); assertEquals(resolvedType, ""); }
@Test public void testResolveShouldNotResolveWithoutInvalidRegexSyntax() throws Exception { givenRequestWithUrl("www.typeless.com/urls/resolvable.html"); parameters = new ParameterList(); parameters.addParameter(new Parameter("type:InvalidPattern", "url:[")); String resolvedType = underTest.resolve(request, parameters); assertEquals(resolvedType, ""); }
@Test public void testResolveShouldNotResolveNonRequestEnities() { String result = underTest.resolve(new WilmaHttpEntity(), parameters); assertEquals(result, ""); }
@Test public void testResolveShouldResolveExactUrlTargets() throws Exception { givenRequestWithUrl("www.epam.com/urls/target.html"); String resolvedType = underTest.resolve(request, parameters); assertEquals(resolvedType, "ExactResolvable"); }
@Test public void testResolveShouldResolveRegexUrlTargets() throws Exception { givenRequestWithUrl("www.anysite.com/urls/regex.html"); String resolvedType = underTest.resolve(request, parameters); assertEquals(resolvedType, "RegexResolvable"); }
@Test public void testResolveShouldResolveXpathTypeQueries() throws Exception { givenRequestWithUrl("www.xpath.com/query/test"); given(xmlTypeResolver.getValue(XPATH_QUERY, REQUEST_BODY)).willReturn("XpathType"); String resolvedType = underTest.resolve(request, parameters); assertEquals(resolvedType, "XpathType"); }