@Test
public void verifyThatFindOneThrowsIncorrectResultSizeDataAccessExceptionWhenMoreResults() throws Exception {

    Class<Object> expectedClass = Object.class;
    when(contextSourceMock.getReadOnlyContext()).thenReturn(dirContextMock);
    when(odmMock.filterFor(expectedClass,
            new EqualsFilter("ou", "somevalue"))).thenReturn(new EqualsFilter("ou", "somevalue"));
    DirContextAdapter expectedObject = new DirContextAdapter();
    SearchResult searchResult = new SearchResult("", expectedObject, new BasicAttributes());
    setupSearchResults(searchControlsRecursive(), new SearchResult[]{searchResult, searchResult});
    Object expectedResult = expectedObject;
    when(odmMock.mapFromLdapDataEntry(expectedObject, expectedClass)).thenReturn(expectedResult, expectedResult);
    try {
        tested.findOne(query().where("ou").is("somevalue"), expectedClass);
        fail("EmptyResultDataAccessException expected");
    } catch (IncorrectResultSizeDataAccessException expected) {
        assertThat(true).isTrue();
    }
    verify(namingEnumerationMock).close();
    verify(dirContextMock).close();
}