@Test
  public void testStartupDetectsInvalidAuthenticationManager() throws Exception {
    AbstractAuthenticationProcessingFilter filter = new MockAuthenticationFilter();
    filter.setAuthenticationFailureHandler(failureHandler);
    successHandler.setDefaultTargetUrl("/");
    filter.setAuthenticationSuccessHandler(successHandler);
    filter.setFilterProcessesUrl("/j_spring_security_check");

    try {
      filter.afterPropertiesSet();
      fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
      assertEquals("authenticationManager must be specified", expected.getMessage());
    }
  }
  @Test
  public void testGettersSetters() throws Exception {
    AbstractAuthenticationProcessingFilter filter = new MockAuthenticationFilter();
    filter.setAuthenticationManager(mock(AuthenticationManager.class));
    filter.setFilterProcessesUrl("/p");
    filter.afterPropertiesSet();

    assertNotNull(filter.getRememberMeServices());
    filter.setRememberMeServices(new TokenBasedRememberMeServices());
    assertEquals(TokenBasedRememberMeServices.class, filter.getRememberMeServices().getClass());
    assertTrue(filter.getAuthenticationManager() != null);
    assertEquals("/p", filter.getFilterProcessesUrl());
  }
  @Test
  public void testStartupDetectsInvalidFilterProcessesUrl() throws Exception {
    AbstractAuthenticationProcessingFilter filter = new MockAuthenticationFilter();
    filter.setAuthenticationFailureHandler(failureHandler);
    filter.setAuthenticationManager(mock(AuthenticationManager.class));
    filter.setAuthenticationSuccessHandler(successHandler);
    filter.setFilterProcessesUrl(null);

    try {
      filter.afterPropertiesSet();
      fail("Should have thrown IllegalArgumentException");
    } catch (IllegalArgumentException expected) {
      assertEquals("filterProcessesUrl must be specified", expected.getMessage());
    }
  }