@Test
    void testGetInstanceWithType() throws Exception {
        final String name = "my/jndi/resource";
        final String returnValue = "jndiString";
        JndiObjectFactory<String> underTest = new JndiObjectFactory<String>() {
            @Override
            protected Object lookup(String jndiName, Class requiredType) throws NamingException {
                assertEquals(name, jndiName);
                assertEquals(String.class, requiredType);
                return new String(returnValue);
            }
        };

        underTest.setRequiredType(String.class);
        underTest.setResourceName(name);

        assertEquals(returnValue, underTest.getInstance());
    }
This test makes the assumption that {@link JndiLocator} is tested elsewhere and only makes an attempt to test the
functionality added by {@link JndiObjectFactory}.
core/src/test/java/org/apache/shiro/jndi/JndiObjectFactoryTest.java