Retrieving a thumbnail photo for an ActiveDirectory account
Without changing the code significantly what you need is a seam to insert a different LDAPConnection, and possibly properties. To create the seam for LDAPConnection you've got a couple of different options


Create a class that extends from the current to and overrides getAdConnection()
Constructor inject a LDAPConnectionFactory to the object and use that to replace getAdConnection()


Once you've done one of these you can inject your mock and make some assertions about how the search in being conducted and return a result structure.