Skip to content

Conversation

@proski
Copy link

@proski proski commented Jun 12, 2019

*  StashRepository: Implement in terms of Job, not AbstractProject
   
   Change startJob() to return Queue.Item. Adjust unit tests to get build
   parameters directly from the return value of startJob().
   
   Make the project field in unit tests a partial mock ("spy" in Mockito
   parlance) to allow the build to be scheduled inside Jenkins code while
   keeping control over its behavior.

This is one of the commits from #69 posted separately to facilitate review.

This change is inspired by the original PR by @rhencke, but it uses a different call to ParameterizedJobMixIn.scheduleBuild2, the one called the "convenience method" and recommended for triggers. It takes care of the quiet period and makes it unnecessary to use any raw types in our code.

https://javadoc.jenkins.io/jenkins/model/ParameterizedJobMixIn.html#scheduleBuild2-hudson.model.Job-int-hudson.model.Action...-

The unit tests have been changed as well. Mockito cannot intercept static method calls, but it can examine the resulting queue item and take the parameters from it.

Change startJob() to return Queue.Item. Adjust unit tests to get build
parameters directly from the return value of startJob().

Make the project field in unit tests a partial mock ("spy" in Mockito
parlance) to allow the build to be scheduled inside Jenkins code while
keeping control over its behavior.
@jakub-bochenski jakub-bochenski merged commit 2ab923a into jenkinsci:master Jun 25, 2019
@proski proski deleted the stashrepository-job branch June 25, 2019 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants