@Test
    void singleServiceTest() throws Exception {

        ServletContext servletContext = EasyMock.mock(ServletContext.class);
        expect(servletContext.getInitParameter("shiroEnvironmentClass")).andReturn(null);
        expect(servletContext.getInitParameter("shiroConfigLocations")).andReturn(null);
        expect(servletContext.getResourceAsStream("/WEB-INF/shiro.ini")).andReturn(
                getClass().getResourceAsStream("/EmptyShiroIni.ini"));

        EasyMock.replay(servletContext);

        WebEnvironment resultEnvironment = new EnvironmentLoader().createEnvironment(servletContext);

        EasyMock.verify(servletContext);

        assertThat(resultEnvironment, instanceOf(IniWebEnvironment.class));
        IniWebEnvironment environmentStub = (IniWebEnvironment) resultEnvironment;

        assertThat(environmentStub.getServletContext(), sameInstance(servletContext));
    }
Tests for {@link EnvironmentLoader} which will use a ServiceLoader.
web/src/test/java/org/apache/shiro/web/env/EnvironmentLoaderServiceTest.java