"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/test/java/hudson/util/CyclicGraphDetectorTest.java" between
jenkins-jenkins-2.302.tar.gz and jenkins-jenkins-2.303.tar.gz

About: Jenkins is a automation server (written in Java) which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software (for e.g. as Continuous Integration and Continuous Delivery server). Weekly release.

CyclicGraphDetectorTest.java  (jenkins-jenkins-2.302):CyclicGraphDetectorTest.java  (jenkins-jenkins-2.303)
package hudson.util; package hudson.util;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import hudson.util.CyclicGraphDetector.CycleDetectedException; import hudson.util.CyclicGraphDetector.CycleDetectedException;
import org.junit.Test; import org.junit.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
/** /**
skipping to change at line 64 skipping to change at line 64
*/ */
void check() throws Exception { void check() throws Exception {
new CyclicGraphDetector<String>() { new CyclicGraphDetector<String>() {
@Override @Override
protected Set<String> getEdges(String s) { protected Set<String> getEdges(String s) {
return edges(s); return edges(s);
} }
}.run(nodes()); }.run(nodes());
} }
void mustContainCycle(String... members) throws Exception { void mustContainCycle(String... members) {
try { final CycleDetectedException e = assertThrows("Cycle expected",
check(); CycleDetectedException.class, this::check);
fail("Cycle expected");
} catch (CycleDetectedException e) { final String msg = "Expected cycle of " + Arrays.asList(members) + "
String msg = "Expected cycle of " + Arrays.asList(members) + " b but found " + e.cycle;
ut found " + e.cycle; for (String s : members) {
for (String s : members) assertTrue(msg, e.cycle.contains(s));
assertTrue(msg, e.cycle.contains(s));
} }
} }
} }
@Test @Test
public void cycle1() throws Exception { public void cycle1() {
new Graph().e("A","B").e("B","C").e("C","A").mustContainCycle("A","B","C "); new Graph().e("A","B").e("B","C").e("C","A").mustContainCycle("A","B","C ");
} }
@Test @Test
public void cycle2() throws Exception { public void cycle2() throws Exception {
new Graph().e("A","B").e("B","C").e("C","C").mustContainCycle("C"); new Graph().e("A","B").e("B","C").e("C","C").mustContainCycle("C");
} }
@Test @Test
public void cycle3() throws Exception { public void cycle3() {
new Graph().e("A","B").e("B","C").e("C","D").e("B","E").e("E","D").e("E" ,"A").mustContainCycle("A","B","E"); new Graph().e("A","B").e("B","C").e("C","D").e("B","E").e("E","D").e("E" ,"A").mustContainCycle("A","B","E");
} }
} }
 End of changes. 5 change blocks. 
12 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)