PluginService { public void init(final ServletContext servletContext) { final String contextRootDir = getContextRootDir(servletContext); final String pluginDir = getPlugins(servletContext, "plugins"); if (contextRootDir != null && pluginDir != null) { pluginManager.init(contextRootDir, pluginDir); } } PluginService(); @Inject  PluginService(PluginManager pluginManager); static PluginService getInstance(); void init(final ServletContext servletContext);  }
@Test public void initTest() { String path = "/home/dorinha/"; pluginService = createPluginsService(path); pluginService.init(mock(ServletContext.class)); verify(pluginManager).init(path, path); }
@Test public void initTestNullDirs() { String path = null; pluginService = createPluginsService(path); pluginService.init(mock(ServletContext.class)); verify(pluginManager, never()).init(anyString(), anyString()); }