LdapPersonAttributeDao extends AbstractQueryPersonAttributeDao<LogicalFilterWrapper> implements InitializingBean { @Override public void afterPropertiesSet() { final Map<String, Set<String>> resultAttributeMapping = this.getResultAttributeMapping(); if (this.setReturningAttributes && resultAttributeMapping != null) { this.searchControls.setReturningAttributes(resultAttributeMapping.keySet().toArray(new String[resultAttributeMapping.size()])); } if (this.contextSource == null) { throw new BeanCreationException("contextSource must be set"); } } LdapPersonAttributeDao(); @Override void afterPropertiesSet(); String getBaseDN(); void setBaseDN(String baseDN); ContextSource getContextSource(); synchronized void setContextSource(final ContextSource contextSource); synchronized void setLdapTemplate(final LdapTemplate ldapTemplate); SearchControls getSearchControls(); void setSearchControls(final SearchControls searchControls); QueryType getQueryType(); void setQueryType(final QueryType queryType); String getQueryTemplate(); void setQueryTemplate(final String queryTemplate);  }
@Test public void testNullContext() throws Exception { final LdapPersonAttributeDao impl = new LdapPersonAttributeDao(); try { impl.afterPropertiesSet(); fail("BeanCreationException should have been thrown with no context configured"); } catch (final BeanCreationException ise) { } }