JerseySpringIntegrationContextListener implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent arg0) { JerseyRestApplication.getResourcesMap().put(serverData.getModule().getContext(), ListX.fromIterable(serverData.getResources())); JerseyRestApplication.getPackages().put(serverData.getModule().getContext(), serverData.getModule().getDefaultJaxRsPackages()); JerseyRestApplication.getResourcesClasses().put(serverData.getModule().getContext(), serverData.getModule().getDefaultResources()); JerseyRestApplication.getResourceConfigManager().put(serverData.getModule().getContext(), serverData.getModule().getResourceConfigManager()); JerseyRestApplication.getServerPropertyMap().put(serverData.getModule().getContext(), serverData.getModule().getServerProperties()); } JerseySpringIntegrationContextListener(ServerData serverData); @Override void contextDestroyed(ServletContextEvent arg0); @Override void contextInitialized(ServletContextEvent arg0);  }
@Test public void testContextInitialized() { listener.contextInitialized(null); assertThat(JerseyRestApplication.getResourcesMap().get(serverData.getModule().getContext()) , equalTo(Arrays.asList())); assertThat(JerseyRestApplication.getPackages().get(serverData.getModule().getContext()),is( serverData.getModule().getDefaultJaxRsPackages())); assertThat(JerseyRestApplication.getResourcesClasses().get(serverData.getModule().getContext()), is(serverData.getModule().getDefaultResources())); }