@BeforeEach
    public void setUp() {
        factory = new JndiLdapContextFactory() {
            //Fake a JNDI environment for the tests:
            @Override
            protected LdapContext createLdapContext(Hashtable env) throws NamingException {
                return createNiceMock(LdapContext.class);
            }
        };
    }
Tests for the {@link JndiLdapContextFactory} class.

@since 1.1
core/src/test/java/org/apache/shiro/realm/ldap/JndiLdapContextFactoryTest.java