}
public void testProcess() {
SimpleRootModuleDefinition a = new SimpleRootModuleDefinition("a", (String)null);
ModuleDefinition a1 = newDefinition(a, "a1", null);
ModuleDefinition a2 = newDefinition(a1, "a2", null);
ModuleDefinition a3 = newDefinition(a2, "a3", null);
ModuleDefinition a4 = newDefinition(a3, "a4", null);
Collection<ModuleDefinition> modules = ModuleDefinitionUtils.getDependentModules(a, "a");
expect(moduleRuntimeManager.initModule(application, a1)).andReturn(true);
expect(moduleRuntimeManager.initModule(application, a2)).andReturn(false);
replay(moduleRuntimeManager);
for (ModuleDefinition moduleDefinition : modules) {
processor.process(application, a, moduleDefinition);
}
verify(moduleRuntimeManager);
assertEquals(ModuleState.LOADED, a1.getState());
assertEquals(ModuleState.ERROR, a2.getState());
assertEquals(ModuleState.DEPENDENCY_FAILED, a3.getState());
assertEquals(ModuleState.DEPENDENCY_FAILED, a4.getState());
}