assertEquals("Servlet says: ",fdef.getParameterMap().get("message"));
}
@Test
public void testOverwriteFilterMapping() throws Exception {
WebXml webxml = new WebXml();
FilterDef filterDef = new FilterDef();
filterDef.setFilterName("paramFilter");
filterDef.setFilterClass("org.apache.catalina.startup.ParamFilter");
filterDef.addInitParameter("message", "tomcat");
filterDef.setDescription("Description");
filterDef.setDisplayName("DisplayName");
filterDef.setLargeIcon("LargeIcon");
filterDef.setSmallIcon("SmallIcon");
filterDef.setAsyncSupported("true");
webxml.addFilter(filterDef);
FilterMap filterMap = new FilterMap();
filterMap.addURLPattern("/param1");
filterMap.setFilterName("paramFilter");
webxml.addFilterMapping(filterMap);
ContextConfig config = new ContextConfig();
File sFile = paramClassResource(
"org/apache/catalina/startup/ParamServlet");
config.processAnnotationsFile(sFile, webxml, false);
File fFile = paramClassResource(
"org/apache/catalina/startup/ParamFilter");
config.processAnnotationsFile(fFile, webxml, false);
FilterDef fdef = webxml.getFilters().get("paramFilter");
assertNotNull(fdef);
assertEquals(filterDef,fdef);
assertEquals("tomcat",fdef.getParameterMap().get("message"));
Set<FilterMap> filterMappings = webxml.getFilterMappings();
assertTrue(filterMappings.contains(filterMap));
// annotation mapping not added s. Servlet Spec 3.0 (Nov 2009)
// 8.2.3.3.vi page 81
String[] urlPatterns = filterMap.getURLPatterns();
assertNotNull(urlPatterns);