@Test
public void testAuthenticateWithTwoUsersFoundShouldThrowException() throws Exception {

	when(contextSourceMock.getReadOnlyContext()).thenReturn(dirContextMock);
	Object expectedObject = new DirContextAdapter(new BasicAttributes(), LdapUtils.newLdapName("cn=john doe"),
               LdapUtils.newLdapName("dc=jayway, dc=se"));
	SearchResult searchResult1 = new SearchResult("", expectedObject, new BasicAttributes());
	SearchResult searchResult2 = new SearchResult("", expectedObject, new BasicAttributes());
	setupSearchResults(searchControlsRecursive(), new SearchResult[] { searchResult1, searchResult2 });
	try {
		tested.authenticate(nameMock, "(ou=somevalue)", "password", entryContextCallbackMock);
		fail("IncorrectResultSizeDataAccessException expected");
	}
	catch (IncorrectResultSizeDataAccessException expected) {
		// expected
	}
       verify(dirContextMock).close();
}