### Question:
ChangeRequestExecutor { void execute() { Endpoint endpoint=changeRequest.getEndpoint(); String host = endpoint.getHost(); try { LOGGER.debug("Executing request for: " + host); LdapConnectionResult ldapConnectionResult = driverGetInstance().connect(endpoint); for (ModificationDetails modificationDetails : changeRequest.getModificationDetailsList()) { Modification modification = apacheAPIConverter.toModification(modificationDetails); ldapConnectionResult.getConnection().modify(modificationDetails.getDn(), modification); } } catch (LdapException | BaseException e) { LOGGER.error("Change Execution failed for Endpoint: " + host, e); endpoint.setDestinationType(DestinationType.NONE); throw new ChangeRequestFailedException(e.getMessage(), host); } } ChangeRequestExecutor(ChangeRequest changeRequest);   }### Answer:
@Test @Ignore public void testExecute() { SearchRequest searchRequest = mock(SearchRequest.class); Endpoint endpoint = mock(Endpoint.class); ModificationDetails modificationDetails= mock(ModificationDetails.class); List<ModificationDetails> modificationDetailsList= new ArrayList<ModificationDetails>(); modificationDetailsList.add(modificationDetails); Modification modification= new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, "givenName", "ChangedTest1"); LdapConnectionResult ldapConnectionResult = mock(LdapConnectionResult.class); LdapConnection ldapConnection = mock(LdapNetworkConnection.class); ldapConnectionResult.setConnection(ldapConnection); RoundtripResult roundtripResult = mock(RoundtripResult.class); when(changeRequest.getEndpoint()).thenReturn(endpoint); doReturn(driver).when(changeRequestExecutor).driverGetInstance(); when(driver.connect(any(Endpoint.class))).thenReturn(ldapConnectionResult); when(changeRequest.getModificationDetailsList()).thenReturn(modificationDetailsList); when(ldapConnectionResult.getConnection()).thenReturn(ldapConnection); when(ldapConnectionResult.connectionSucceeded()).thenReturn(true); changeRequestExecutor.execute(); verify(driver, times(1)).connect(any(Endpoint.class)); }