### Question:
ModuleUtil { public static Module getModuleForPath(String path) { int ind = path.lastIndexOf('/'); if (ind <= 0) { throw new IllegalArgumentException( "Input must be /moduleId/resource. Input needs a / after the first character: " + path); } String moduleId = path.startsWith("/") ? path.substring(1, ind) : path.substring(0, ind); moduleId = moduleId.replace('/', '.'); while (true) { Module mod = ModuleFactory.getStartedModuleById(moduleId); if (mod != null) { return mod; } ind = moduleId.lastIndexOf('.'); if (ind < 0) { break; } moduleId = moduleId.substring(0, ind); } return null; } private  ModuleUtil(); static void startup(Properties props); static void shutdown(); static File insertModuleFile(InputStream inputStream, String filename); static boolean isOpenmrsVersionInVersions(String ...versions); static boolean matchRequiredVersions(String version, String versionRange); static void checkRequiredVersion(String version, String versionRange); static int compareVersion(String version, String value); static boolean isVersionWithQualifier(String version); static File getModuleRepository(); static URL file2url(final File file); static void expandJar(File fileToExpand, File tmpModuleDir, String name, boolean keepFullPath); static InputStream getURLStream(URL url); static String getURL(URL url); static Boolean checkForModuleUpdates(); static Boolean allowAdmin(); static AbstractRefreshableApplicationContext refreshApplicationContext(AbstractRefreshableApplicationContext ctx); static AbstractRefreshableApplicationContext refreshApplicationContext(AbstractRefreshableApplicationContext ctx,
	        boolean isOpenmrsStartup, Module startedModule); static boolean ignoreCoreModules(); static List<String> getMandatoryModules(); static Module getModuleForPath(String path); static String getPathForResource(Module module, String path); static Collection<String> getPackagesFromFile(File file); static InputStream getResourceFromApi(JarFile jarFile, String moduleId, String version, String resource); static File getDevelopmentDirectory(String moduleId);  }### Answer:
@Test public void getModuleForPath_shouldHandleUiSpringmvcCssUiDotCssWhenUiDotSpringmvcModuleIsRunning() { ModuleFactory.getStartedModulesMap().clear(); Module module = new Module("For Unit Test"); module.setModuleId("ui.springmvc"); ModuleFactory.getStartedModulesMap().put(module.getModuleId(), module); String path = "/ui/springmvc/css/ui.css"; Assert.assertEquals(module, ModuleUtil.getModuleForPath(path)); ModuleFactory.getStartedModulesMap().clear(); }
@Test public void getModuleForPath_shouldHandleUiSpringmvcCssUiDotCssWhenUiModuleIsRunning() { ModuleFactory.getStartedModulesMap().clear(); Module module = new Module("For Unit Test"); module.setModuleId("ui"); ModuleFactory.getStartedModulesMap().put(module.getModuleId(), module); String path = "/ui/springmvc/css/ui.css"; Assert.assertEquals(module, ModuleUtil.getModuleForPath(path)); ModuleFactory.getStartedModulesMap().clear(); }
@Test public void getModuleForPath_shouldReturnNullForUiSpringmvcCssUiDotCssWhenNoRelevantModuleIsRunning() { ModuleFactory.getStartedModulesMap().clear(); String path = "/ui/springmvc/css/ui.css"; Assert.assertNull(ModuleUtil.getModuleForPath(path)); }