ServletContextHelper { public ServletContextImpl getResolvedContext(final List<ServletContextImpl> servletContexts, final String path) { for (ServletContextImpl servletContext : servletContexts) { if (path.startsWith(servletContext.getContextPath())) { return servletContext; } } return null; }  ServletMapping getResolvedServletMapping(final ServletContext servletContext, final String path); ServletContextImpl getResolvedContext(final List<ServletContextImpl> servletContexts, final String path); List<FilterMapping> getFilterMappingsForPath(final ServletContext servletContext, final String path);  }
@Test public void shouldNotResolveContextIfNoMatch() { assertThat(servletContextHelper.getResolvedContext(Arrays.asList(servletContext), "/invalid/someurl"), is(nullValue())); }
@Test public void shouldNotResolveContext() { assertThat(servletContextHelper.getResolvedContext(Arrays.asList(servletContext), "/context/someurl"), is(servletContext)); }