### Question:
ModuleUtil { protected static void checkMandatoryModulesStarted() throws ModuleException { List<String> mandatoryModuleIds = getMandatoryModules(); Set<String> startedModuleIds = ModuleFactory.getStartedModulesMap().keySet(); mandatoryModuleIds.removeAll(startedModuleIds); if (!mandatoryModuleIds.isEmpty()) { throw new MandatoryModuleException(mandatoryModuleIds); } } 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(expected = MandatoryModuleException.class) public void checkMandatoryModulesStarted_shouldThrowModuleExceptionIfAMandatoryModuleIsNotStarted() { assertThat(ModuleFactory.getStartedModules(), empty()); GlobalProperty gp1 = new GlobalProperty("module1.mandatory", "true"); Context.getAdministrationService().saveGlobalProperty(gp1); ModuleUtil.checkMandatoryModulesStarted(); }