@Test
public void testTwoExceptionNoOneAuthenticates() {

  Authentication authentication = new TestingAuthenticationToken("principal", "credentials");
  expect(mockLdapProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg1") {});
  expect(mockFileProvider.authenticate(authentication)).andThrow(new AuthenticationException("msg2") {});
  expect(mockExternalServerProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
  expect(mockSimpleProvider.authenticate(authentication)).andReturn(FAILED_AUTHENTICATION);
  
  replay(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
  
  try {
    provider.authenticate(authentication);
    assertTrue("Should have thrown AuthenticationException", false);
  } catch(AuthenticationException e) {
    assertEquals(e.getMessage(), "msg1");
  }
  
  verify(mockLdapProvider, mockFileProvider, mockSimpleProvider, mockExternalServerProvider);
}