WebXmlParser { static void parseWebXml(SessionConfiguration conf, ServletContext context) { InputStream is = context.getResourceAsStream("/WEB-INF/web.xml"); parseStream(conf, is); } private  WebXmlParser();   }
@Test public void testParseXml() throws IOException { try (ByteArrayInputStream bais = new ByteArrayInputStream(withUrlTrackingMode.getBytes("UTF-8"))) { SessionConfiguration sessionConfiguration = new SessionConfiguration(); ServletContext context = mock(ServletContext.class); when(context.getResourceAsStream("/WEB-INF/web.xml")).thenReturn(bais); WebXmlParser.parseWebXml(sessionConfiguration, context); assertEquals(1, sessionConfiguration.getSessionTracking().length); assertEquals("URL", sessionConfiguration.getSessionTracking()[0]); } }