### Question:
AmbariLdapFacade implements LdapFacade { @Override public void checkConnection(AmbariLdapConfiguration ambariLdapConfiguration) throws AmbariLdapException { try { ldapConfigurationService.checkConnection(ambariLdapConfiguration); LOGGER.info("Validating LDAP connection related configuration: SUCCESS"); } catch (Exception e) { LOGGER.error("Validating LDAP connection configuration failed", e); throw new AmbariLdapException(e); } } @Inject  AmbariLdapFacade(); @Override void checkConnection(AmbariLdapConfiguration ambariLdapConfiguration); @Override AmbariLdapConfiguration detectAttributes(AmbariLdapConfiguration ambariLdapConfiguration); @Override Set<String> checkLdapAttributes(Map<String, Object> parameters, AmbariLdapConfiguration ldapConfiguration);  }### Answer:
@Test public void testShouldConfigurationCheckDelegateToTheRightServiceCall() throws Exception { ldapConfigurationServiceMock.checkConnection(EasyMock.capture(ambariLdapConfigurationCapture)); replayAll(); ldapFacade.checkConnection(ambariLdapConfiguration); Assert.assertEquals("The configuration instance souldn't change before passing it to the service", ambariLdapConfiguration, ambariLdapConfigurationCapture.getValue()); }
@Test(expected = AmbariLdapException.class) public void testShouldConfigurationCheckFailureResultInAmbariLdapException() throws Exception { ldapConfigurationServiceMock.checkConnection(EasyMock.anyObject(AmbariLdapConfiguration.class)); EasyMock.expectLastCall().andThrow(new AmbariLdapException("Testing ...")); replayAll(); ldapFacade.checkConnection(ambariLdapConfiguration); }