AuthenticationFilter implements Filter { protected Properties getConfiguration() { return config; }  @Override void init(FilterConfig filterConfig); static SignerSecretProvider constructSecretProvider(
      ServletContext ctx, Properties config,
      boolean disallowFallbackToRandomSecretProvider); @Override void destroy(); @Override void doFilter(ServletRequest request,
                       ServletResponse response,
                       FilterChain filterChain); static void createAuthCookie(HttpServletResponse resp, String token,
                                      String domain, String path, long expires,
                                      boolean isCookiePersistent,
                                      boolean isSecure); static final String CONFIG_PREFIX; static final String AUTH_TYPE; static final String SIGNATURE_SECRET; static final String SIGNATURE_SECRET_FILE; static final String AUTH_TOKEN_MAX_INACTIVE_INTERVAL; static final String AUTH_TOKEN_VALIDITY; static final String COOKIE_DOMAIN; static final String COOKIE_PATH; static final String COOKIE_PERSISTENT; static final String SIGNER_SECRET_PROVIDER; static final String SIGNER_SECRET_PROVIDER_ATTRIBUTE; }
@Test public void testGetConfiguration() throws Exception { AuthenticationFilter filter = new AuthenticationFilter(); FilterConfig config = Mockito.mock(FilterConfig.class); Mockito.when(config.getInitParameter(AuthenticationFilter.CONFIG_PREFIX)).thenReturn(""); Mockito.when(config.getInitParameter("a")).thenReturn("A"); Mockito.when(config.getInitParameterNames()).thenReturn(new Vector<String>(Arrays.asList("a")).elements()); Properties props = filter.getConfiguration("", config); Assert.assertEquals("A", props.getProperty("a")); config = Mockito.mock(FilterConfig.class); Mockito.when(config.getInitParameter(AuthenticationFilter.CONFIG_PREFIX)).thenReturn("foo"); Mockito.when(config.getInitParameter("foo.a")).thenReturn("A"); Mockito.when(config.getInitParameterNames()).thenReturn(new Vector<String>(Arrays.asList("foo.a")).elements()); props = filter.getConfiguration("foo.", config); Assert.assertEquals("A", props.getProperty("a")); }