1818import java .io .IOException ;
1919import java .io .InputStream ;
2020import java .net .URL ;
21- import java .util .HashMap ;
22- import java .util .Map ;
2321
2422import javax .servlet .ServletContext ;
2523
2624import org .easymock .EasyMock ;
2725import org .junit .Assert ;
28- import org .junit .BeforeClass ;
2926import org .junit .Test ;
3027import org .xml .sax .SAXException ;
3128
3835 */
3936public class PrettyConfiguratorTest
4037{
41- private final static Map servlets = new HashMap <String , MockFacesServletRegistration >();
42-
4338 final ClassLoader mockResourceLoader = new MockClassLoader (mockPrettyConfigURL ());
4439 final ClassLoader mockEmptyResourceLoader = new MockClassLoader ();
4540
46- @ BeforeClass
47- @ SuppressWarnings ("unchecked" )
48- public static void beforeClass ()
49- {
50- servlets .put ("Faces Servlet" , new MockFacesServletRegistration ());
51- }
52-
5341 @ Test
5442 public void testMETAINFConfiguration () throws SAXException , IOException
5543 {
5644 final ServletContext servletContext = EasyMock .createNiceMock (ServletContext .class );
5745
5846 EasyMock .expect (servletContext .getMajorVersion ()).andReturn (3 ).anyTimes ();
59- EasyMock .expect (servletContext .getServletRegistrations ()).andReturn (servlets ).anyTimes ();
6047 EasyMock .expect (servletContext .getInitParameter (PrettyContext .CONFIG_KEY )).andReturn (null ).anyTimes ();
61- EasyMock .expect (servletContext .getClassLoader ()).andReturn (mockResourceLoader ).anyTimes ();
6248 EasyMock .expect (servletContext .getResourceAsStream (DefaultXMLConfigurationProvider .DEFAULT_PRETTY_FACES_CONFIG )).andReturn (null ).anyTimes ();
6349
6450 final PrettyConfigurator configurator = new PrettyConfigurator (servletContext );
@@ -70,14 +56,11 @@ public void testMETAINFConfiguration() throws SAXException, IOException
7056 }
7157
7258 @ Test
73- @ SuppressWarnings ("unchecked" )
7459 public void testInitParameterLocationConfiguration () throws SAXException , IOException
7560 {
7661 final ServletContext servletContext = EasyMock .createNiceMock (ServletContext .class );
7762
7863 EasyMock .expect (servletContext .getMajorVersion ()).andReturn (3 ).anyTimes ();
79- EasyMock .expect (servletContext .getServletRegistrations ()).andReturn (servlets ).anyTimes ();
80- EasyMock .expect (servletContext .getClassLoader ()).andReturn (mockEmptyResourceLoader ).anyTimes ();
8164 EasyMock .expect (servletContext .getInitParameter (PrettyContext .CONFIG_KEY )).andReturn ("car.xml, cdr.xml" ).anyTimes ();
8265 EasyMock .expect (servletContext .getInitParameter (ClassLoaderConfigurationProvider .CLASSPATH_CONFIG_ENABLED )).andReturn ("false" ).anyTimes ();
8366 EasyMock .expect (servletContext .getResourceAsStream ("car.xml" )).andReturn (mockPrettyConfigInputStream ()).anyTimes ();
0 commit comments