Skip to content
Permalink
Browse files

[JENKINS-20662] Add test.

  • Loading branch information
daniel-beck committed Apr 18, 2014
1 parent e6e7526 commit 26735ec022d57ffd48340d5aa641e80b84b022c2
Showing with 33 additions and 0 deletions.
  1. +33 −0 test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
@@ -0,0 +1,33 @@
package jenkins.model.lazy

import hudson.model.Run
import hudson.model.TaskListener
import hudson.model.listeners.RunListener
import org.junit.Rule
import org.junit.Test
import org.jvnet.hudson.test.Bug
import org.jvnet.hudson.test.JenkinsRule

class LazyBuildMixIn_Test {
@Rule
public JenkinsRule r = new JenkinsRule();

@Test
@Bug(20662)
public void testNewRunningBuildRelationFromPrevious() {
RunListener<Run> listener = new RunListener<Run>() {
@Override public void onCompleted(Run r, TaskListener listener) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
};
RunListener.all().add(listener);
def p = r.createFreeStyleProject();
def b1 = p.scheduleBuild2(0).get();
assert null == b1.getNextBuild();
def b2 = p.scheduleBuild2(0).waitForStart();
assert b2 == b1.getNextBuild();
}
}

0 comments on commit 26735ec

Please sign in to comment.
You can’t perform that action at this time.