@Test
public void testTopoSortCyclicGraphNoSources() {

	try {
		JobVertex v1 = new JobVertex("1");
		JobVertex v2 = new JobVertex("2");
		JobVertex v3 = new JobVertex("3");
		JobVertex v4 = new JobVertex("4");
		
		v1.connectNewDataSetAsInput(v4, DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED);
		v2.connectNewDataSetAsInput(v1, DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED);
		v3.connectNewDataSetAsInput(v2, DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED);
		v4.connectNewDataSetAsInput(v3, DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED);
		JobGraph jg = new JobGraph("Cyclic Graph", v1, v2, v3, v4);
		try {
			jg.getVerticesSortedTopologicallyFromSources();
			fail("Failed to raise error on topologically sorting cyclic graph.");
		}
		catch (InvalidProgramException e) {
			// that what we wanted
		}
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}