### Question:
WebConfiguration { public String getConfigurationLocation() { String configurationLocation = configuration .getInitParameter(CONFIGURATION_LOCATION_PARAMETER); if (configurationLocation != null) { return configurationLocation; } String name = configuration.getFilterName(); if (name == null) { return null; } if (!name.endsWith(".xml")) { name = name + ".xml"; } return name; } WebConfiguration(final ServletConfig servletConfiguration);  WebConfiguration(FilterConfig filterConfiguration); String getConfigurationLocation(); String getDataDomainName(); Collection<Module> createModules(Module... standardModules); Map<String, String> getParameters(); Map<String, String> getOtherParameters();  }### Answer:
@Test public void testFilterConfigurationLocation_Name() { MockFilterConfig config1 = new MockFilterConfig(); config1.setFilterName("cayenne-x"); WebConfiguration configuration1 = new WebConfiguration(config1); assertEquals("cayenne-x.xml", configuration1.getConfigurationLocation()); MockFilterConfig config2 = new MockFilterConfig(); config2.setFilterName("cayenne-y.xml"); WebConfiguration configuration2 = new WebConfiguration(config2); assertEquals("cayenne-y.xml", configuration2.getConfigurationLocation()); MockFilterConfig config3 = new MockFilterConfig(); config3.setFilterName("a/b/c/cayenne-z.xml"); WebConfiguration configuration3 = new WebConfiguration(config3); assertEquals("a/b/c/cayenne-z.xml", configuration3.getConfigurationLocation()); }
@Test public void testServletConfigurationLocation_Name() { MockServletConfig config1 = new MockServletConfig(); config1.setServletName("cayenne-x"); WebConfiguration configuration1 = new WebConfiguration(config1); assertEquals("cayenne-x.xml", configuration1.getConfigurationLocation()); MockServletConfig config2 = new MockServletConfig(); config2.setServletName("cayenne-y.xml"); WebConfiguration configuration2 = new WebConfiguration(config2); assertEquals("cayenne-y.xml", configuration2.getConfigurationLocation()); MockServletConfig config3 = new MockServletConfig(); config3.setServletName("a/b/c/cayenne-z.xml"); WebConfiguration configuration3 = new WebConfiguration(config3); assertEquals("a/b/c/cayenne-z.xml", configuration3.getConfigurationLocation()); }
@Test public void testFilterConfigurationLocation_Parameter() { MockFilterConfig config1 = new MockFilterConfig(); config1.setFilterName("cayenne-x"); config1.setInitParameter( WebConfiguration.CONFIGURATION_LOCATION_PARAMETER, "cayenne-y.xml"); WebConfiguration configuration1 = new WebConfiguration(config1); assertEquals("cayenne-y.xml", configuration1.getConfigurationLocation()); }
@Test public void testServletConfigurationLocation_Parameter() { MockServletConfig config1 = new MockServletConfig(); config1.setServletName("cayenne-x"); config1.setInitParameter( WebConfiguration.CONFIGURATION_LOCATION_PARAMETER, "cayenne-y.xml"); WebConfiguration configuration1 = new WebConfiguration(config1); assertEquals("cayenne-y.xml", configuration1.getConfigurationLocation()); }