Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correction JENKINS-15474 : does not add the same Cause type multiple …
…times
- Loading branch information
1 parent
a758115
commit 80282bc
Showing
2 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/java/org/jenkinsci/plugins/buildtriggerbadge/RunListenerImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jenkinsci.plugins.buildtriggerbadge; | ||
|
||
import hudson.model.FreeStyleBuild; | ||
import hudson.model.FreeStyleProject; | ||
import hudson.triggers.SCMTrigger.SCMTriggerCause; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.Future; | ||
|
||
import org.jvnet.hudson.test.Bug; | ||
import org.jvnet.hudson.test.HudsonTestCase; | ||
|
||
/** | ||
* Tests for {@link RunListenerImpl} | ||
* @author Michael Pailloncy | ||
*/ | ||
public class RunListenerImplTest extends HudsonTestCase { | ||
|
||
@Bug(15474) | ||
public void testSameIconMultipleTimesCorrection() throws IOException, InterruptedException, ExecutionException{ | ||
FreeStyleProject p = createFreeStyleProject(); | ||
Future<FreeStyleBuild> futureBuild = p.scheduleBuild2(20, new SCMTriggerCause("scm change 1")); | ||
assertFalse(p.scheduleBuild(new SCMTriggerCause("scm change 2"))); | ||
assertFalse(p.scheduleBuild(new SCMTriggerCause("scm change 3"))); | ||
assertFalse(p.scheduleBuild(new SCMTriggerCause("scm change 4"))); | ||
assertFalse(p.scheduleBuild(new SCMTriggerCause("scm change 5"))); | ||
FreeStyleBuild build = futureBuild.get(); | ||
// there should be only one badge action here | ||
assertEquals(1, build.getBadgeActions().size()); | ||
} | ||
} |