@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());
    }
  }
  @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());
    }
  }