* It makes sure that cycles that start a ways into the dependency tree
* are handled correctly.
*/
public void testCycleTest() throws Exception
{
Vertex component1 = new Vertex( "Component1" );
Vertex component2 = new Vertex( "Component2" );
Vertex component3 = new Vertex( "Component3" );
Vertex component4 = new Vertex( "Component4" );
Vertex component5 = new Vertex( "Component5" );
List<Vertex> vertices = new ArrayList<Vertex>( 5 );
vertices.add( component1 );
vertices.add( component2 );
vertices.add( component3 );
vertices.add( component4 );
vertices.add( component5 );
component1.addDependency( component2 );
component2.addDependency( component3 );
component3.addDependency( component4 );
component4.addDependency( component5 );
component5.addDependency( component3 ); // Cycle
try
{
GraphHelper.topologicalSort( vertices );
fail( "Did not detect the expected cyclic dependency" );