Search in sources :

Example 1 with PullRequestSCMHead

use of org.jenkinsci.plugins.github_branch_source.PullRequestSCMHead in project blueocean-plugin by jenkinsci.

the class PipelineJobFiltersTest method testIsPullRequest.

@Test
public void testIsPullRequest() {
    BlueOrganization organization = mockOrganization();
    OrganizationFolder organizationFolder = mockOrgFolder(organization);
    PullRequestSCMHead changeRequestSCMHead = mock(PullRequestSCMHead.class);
    mockStatic(SCMHead.HeadByItem.class);
    when(SCMHead.HeadByItem.findHead(organizationFolder)).thenReturn(changeRequestSCMHead);
    assertTrue(PipelineJobFilters.isPullRequest(organizationFolder));
    assertFalse(new PipelineJobFilters.OriginFilter().getFilter().apply(organizationFolder));
    assertTrue(new PipelineJobFilters.PullRequestFilter().getFilter().apply(organizationFolder));
}
Also used : OrganizationFolder(jenkins.branch.OrganizationFolder) SCMHead(jenkins.scm.api.SCMHead) PullRequestSCMHead(org.jenkinsci.plugins.github_branch_source.PullRequestSCMHead) BlueOrganization(io.jenkins.blueocean.rest.model.BlueOrganization) PullRequestSCMHead(org.jenkinsci.plugins.github_branch_source.PullRequestSCMHead) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

BlueOrganization (io.jenkins.blueocean.rest.model.BlueOrganization)1 OrganizationFolder (jenkins.branch.OrganizationFolder)1 SCMHead (jenkins.scm.api.SCMHead)1 PullRequestSCMHead (org.jenkinsci.plugins.github_branch_source.PullRequestSCMHead)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1