LightAdminWebApplicationInitializer implements WebApplicationInitializer { @Override public void onStartup(final ServletContext servletContext) throws ServletException { if (lightAdminConfigurationNotEnabled(servletContext)) { servletContext.log("LightAdmin Web Administration Module is disabled by default. Skipping."); return; } if (notValidBaseUrl(lightAdminBaseUrl(servletContext))) { servletContext.log("LightAdmin Web Administration Module's 'baseUrl' property must match " + BASE_URL_PATTERN.pattern() + " pattern. Skipping."); return; } if (notValidFileStorageDirectoryDefined(servletContext)) { servletContext.log("LightAdmin Web Administration Module's global file storage directory doesn't exist or not a directory."); return; } registerCustomResourceServlet(servletContext); registerLogoResourceServlet(servletContext); registerLightAdminDispatcher(servletContext); if (notRootUrl(lightAdminBaseUrl(servletContext))) { registerLightAdminDispatcherRedirector(servletContext); } registerHiddenHttpMethodFilter(servletContext); if (lightAdminSecurityEnabled(servletContext)) { registerSpringSecurityFilter(servletContext); } registerCharsetFilter(servletContext); registerTilesDecorationFilter(servletContext); }  @Override void onStartup(final ServletContext servletContext); static String SERVLET_CONTEXT_ATTRIBUTE_NAME; }
@Test public void lightAdminModuleNotConfiguredProperly() throws Exception { final ServletContext servletContext = EasyMock.createMock( ServletContext.class ); expect( servletContext.getInitParameter( LIGHT_ADMINISTRATION_BASE_PACKAGE ) ).andReturn( null ).anyTimes(); expect( servletContext.getInitParameter( LIGHT_ADMINISTRATION_BASE_URL ) ).andReturn( null ).anyTimes(); servletContext.log( "LightAdmin Web Administration Module is disabled by default. Skipping." ); expectLastCall().once(); replay( servletContext ); testee.onStartup( servletContext ); verify( servletContext ); }