Commit cdb1a497 authored by NicolaiO's avatar NicolaiO 🐼

Merge branch '9-add-method-to-check-whether-a-module-is-loaded' into 'master'

Resolve "Add method to check whether a module is loaded"

Closes #9

See merge request !5
parents 0247e20e f41a39bd
Pipeline #2508 passed with stage
in 47 seconds
......@@ -340,6 +340,18 @@ public class Moduli
}
/**
* Check whether a module is loaded.
*
* @param moduleId the Class of the module
* @return if the module is loaded
*/
public boolean isModuleLoaded(Class<? extends AModule> moduleId)
{
return modules.containsKey(moduleId);
}
/**
* Checks, if dependencies can be resolved.
*
......
......@@ -47,6 +47,8 @@ public class ModuliTest
moduli.loadModulesSafe(MODULE_CONFIG_PATH + "test_config.xml");
assertThat(moduli.getModulesState().get(), is(ModulesState.RESOLVED));
assertThat(moduli.isModuleLoaded(TestModule.class), is(true));
moduli.startModules();
assertThat(moduli.getModulesState().get(), is(ModulesState.ACTIVE));
......@@ -77,6 +79,7 @@ public class ModuliTest
{
moduli.loadModulesSafe(MODULE_CONFIG_PATH + "empty_config.xml");
assertThat(moduli.getModulesState().get(), is(ModulesState.RESOLVED));
assertThat(moduli.isModuleLoaded(TestModule.class), is(false));
moduli.startModules();
assertThat(moduli.getModulesState().get(), is(ModulesState.ACTIVE));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment