Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-43507] Measure twice, cut once
- checking with the set eliminates an incorrect copy-pasta error
  • Loading branch information
stephenc committed Jun 22, 2017
1 parent b4759fb commit d603568
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Expand Up @@ -230,7 +230,7 @@ public GitHubSCMNavigator(String apiUri, String repoOwner, String scanCredential
// legacy constructor means legacy defaults
this.traits = new ArrayList<>();
this.traits.add(new BranchDiscoveryTrait(true, true));
this.traits.add(new ForkPullRequestDiscoveryTrait(EnumSet.of(ChangeRequestCheckoutStrategy.HEAD),
this.traits.add(new ForkPullRequestDiscoveryTrait(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE),
new ForkPullRequestDiscoveryTrait.TrustContributors()));
if (!GitHubSCMSource.DescriptorImpl.SAME.equals(checkoutCredentialsId)) {
traits.add(new SSHCheckoutTrait(checkoutCredentialsId));
Expand Down
Expand Up @@ -2,7 +2,9 @@

import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import jenkins.model.Jenkins;
import jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy;
import jenkins.scm.api.trait.SCMTrait;
import jenkins.scm.impl.trait.RegexSCMSourceFilterTrait;
import jenkins.scm.impl.trait.WildcardSCMHeadFilterTrait;
Expand Down Expand Up @@ -1529,7 +1531,7 @@ public void given__legacyCode__when__constructor_cloud__then__discoveryTraitDefa
),
Matchers.<SCMTrait<?>>allOf(
instanceOf(ForkPullRequestDiscoveryTrait.class),
hasProperty("strategyId", is(2)),
hasProperty("strategies", is(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE))),
hasProperty("trust", instanceOf(ForkPullRequestDiscoveryTrait.TrustContributors.class))
)
)
Expand Down Expand Up @@ -1562,7 +1564,7 @@ public void given__legacyCode__when__constructor_server__then__discoveryTraitDef
),
Matchers.<SCMTrait<?>>allOf(
instanceOf(ForkPullRequestDiscoveryTrait.class),
hasProperty("strategyId", is(2)),
hasProperty("strategies", is(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE))),
hasProperty("trust", instanceOf(ForkPullRequestDiscoveryTrait.TrustContributors.class))
),
Matchers.<SCMTrait<?>>allOf(
Expand Down
Expand Up @@ -3,7 +3,9 @@
import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import jenkins.model.Jenkins;
import jenkins.scm.api.mixin.ChangeRequestCheckoutStrategy;
import jenkins.scm.api.trait.SCMSourceTrait;
import jenkins.scm.api.trait.SCMTrait;
import jenkins.scm.impl.trait.WildcardSCMHeadFilterTrait;
Expand Down Expand Up @@ -367,7 +369,7 @@ public void given__legacyCode__when__constructor_cloud__then__discoveryTraitDefa
),
Matchers.<SCMSourceTrait>allOf(
instanceOf(ForkPullRequestDiscoveryTrait.class),
hasProperty("strategyId", is(1)),
hasProperty("strategies", is(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE))),
hasProperty("trust", instanceOf(ForkPullRequestDiscoveryTrait.TrustContributors.class))
)
)
Expand Down Expand Up @@ -403,7 +405,7 @@ public void given__legacyCode__when__constructor_server__then__discoveryTraitDef
),
Matchers.<SCMSourceTrait>allOf(
instanceOf(ForkPullRequestDiscoveryTrait.class),
hasProperty("strategyId", is(1)),
hasProperty("strategies", is(EnumSet.of(ChangeRequestCheckoutStrategy.MERGE))),
hasProperty("trust", instanceOf(ForkPullRequestDiscoveryTrait.TrustContributors.class))
),
Matchers.<SCMSourceTrait>allOf(
Expand Down

0 comments on commit d603568

Please sign in to comment.