import junit.framework.TestCase;
public class SimpleGraphModuleDefinitionTest extends TestCase {
public void testGetDependentModuleNames() {
ModuleDefinition newC = new SimpleModuleDefinition(null, "module-c", ModuleTypes.APPLICATION, null, new String[] {"module-a"}, null, null, null, null, true);
final List<String> cNames = newC.getDependentModuleNames(false);
assertEquals(1, cNames.size());
//and e, with c as parent, and depending also on b
ModuleDefinition newE = new SimpleModuleDefinition(newC, "module-e", ModuleTypes.APPLICATION, null, new String[] {"module-b", "module-d"}, null, null, null, null, true);
//note how parent is implicitly first - appears first in list
final List<String> eNames = newE.getDependentModuleNames(false);
assertEquals(3, eNames.size());
assertEquals("module-c", eNames.get(0));
assertEquals("module-b", eNames.get(1));
assertEquals("module-d", eNames.get(2));
//parent is named explicitly as module: note its position in ordering
ModuleDefinition newF = new SimpleModuleDefinition(newE, "module-f", ModuleTypes.APPLICATION, null, new String[] {"module-d", "module-e"}, null, null, null, null, true);
final List<String> fNames = newF.getDependentModuleNames(false);
assertEquals(2, fNames.size());
assertEquals("module-d", fNames.get(0));
assertEquals("module-e", fNames.get(1));
}