@Test
public void testXacmlInit() {

    logger.info("XACMLRestTest - testInit");
    try {
        XacmlRest.xacmlInit(servletConfig);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        XacmlRest.dumpRequest(httpServletRequest);
        XacmlRest.loadXacmlProperties(null, null);
    } catch (Exception e) {
        fail("Normal case of initiation of XACML REST failed");
    }
    System.clearProperty(XACMLProperties.XACML_PROPERTIES_NAME);
    try {
        XacmlRest.xacmlInit(servletConfig);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        XacmlRest.dumpRequest(httpServletRequest);
        XacmlRest.loadXacmlProperties(null, null);
    } catch (Exception e) {
        fail("Normal case of initiation of XACML REST failed");
    }
    System.clearProperty(XACMLProperties.XACML_PROPERTIES_NAME);
    try {
        Logger.getRootLogger().setLevel(Level.INFO);
        XacmlRest.xacmlInit(servletConfig);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        XacmlRest.dumpRequest(httpServletRequest);
        XacmlRest.loadXacmlProperties(null, null);
    } catch (Exception e) {
        fail("Normal case of initiation of XACML REST failed");
    }
    System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.pdp.properties");
    try {
        Logger.getRootLogger().setLevel(Level.DEBUG);
        XacmlRest.xacmlInit(servletConfig);
        XacmlRest.dumpRequest(httpServletRequest);
        XacmlRest.loadXacmlProperties(null, null);
    } catch (Exception e) {
        fail("Normal case of initiation of XACML REST failed");
    }
    Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn(null);
    try {
        XacmlRest.xacmlInit(servletConfig);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        XacmlRest.dumpRequest(httpServletRequest);
        XacmlRest.loadXacmlProperties(null, null);
    } catch (Exception e) {
        fail("Normal case of initiation of XACML REST failed");
    }
    try {
        Logger.getRootLogger().setLevel(Level.INFO);
        XacmlRest.xacmlInit(servletConfig);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        XacmlRest.dumpRequest(httpServletRequest);
        XacmlRest.loadXacmlProperties(null, null);
    } catch (Exception e) {
        fail("Normal case of initiation of XACML REST failed");
    }
    Mockito.when(servletConfig.getInitParameter("XACML_PROPERTIES_NAME")).thenReturn("xacml.pdp.properties");
    List<String> parNameList = new ArrayList<String>() {
        private static final long serialVersionUID = 1L;
        {
            add("Name0");
            add("Name1");
            add("Name2");
            add("XACML_PROPERTIES_NAME");
        }
    };
    Mockito.when(servletConfig.getInitParameterNames()).thenReturn(Collections.enumeration(parNameList));
    Mockito.when(servletConfig.getInitParameter("Name0")).thenReturn("Value0");
    Mockito.when(servletConfig.getInitParameter("Name1")).thenReturn("Value1");
    Mockito.when(servletConfig.getInitParameter("Name2")).thenReturn("Value2");
    try {
        XacmlRest.xacmlInit(servletConfig);
        Logger.getRootLogger().setLevel(Level.DEBUG);
        XacmlRest.dumpRequest(httpServletRequest);
        XacmlRest.loadXacmlProperties(null, null);
    } catch (Exception e) {
        e.printStackTrace();
        fail("Normal case of initiation of XACML REST failed");
    }
}