Java 类hudson.model.BuildBadgeAction 实例源码

项目:delivery-pipeline-plugin    文件:PromotionStatusProviderTest.java   
@SuppressWarnings("unchecked")
@Test
public void testIsBuildPromotedWhenThereAreNoPromotions() {
    final AbstractBuild<?, ?> mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getAction(any(Class.class))).thenReturn(mock(BuildBadgeAction.class));

    final PromotionStatusProvider.PromotedBuildActionWrapper mockPromotedBuildActionWrapper =
            mock(PromotionStatusProvider.PromotedBuildActionWrapper.class);
    when(mockPromotedBuildActionWrapper.getPromotions(mockBuild)).thenReturn(Collections.<Status>emptyList());

    final PromotionStatusProvider promotionStatusProvider = new PromotionStatusProvider();
    promotionStatusProvider.setPromotedBuildActionWrapper(mockPromotedBuildActionWrapper);

    final boolean isPromoted = promotionStatusProvider.isBuildPromoted(mockBuild);
    assertFalse(isPromoted);
}
项目:delivery-pipeline-plugin    文件:PromotionStatusProviderTest.java   
@SuppressWarnings("unchecked")
@Test
public void testIsBuildPromotedWhenThereArePromotions() {
    final AbstractBuild<?, ?> mockBuild = mock(AbstractBuild.class);
    when(mockBuild.getAction(any(Class.class))).thenReturn(mock(BuildBadgeAction.class));

    final List<Status> mockPromotionList = new ArrayList<>();
    PowerMockito.mockStatic(Status.class);
    mockPromotionList.add(mock(Status.class));

    final PromotionStatusProvider.PromotedBuildActionWrapper mockPromotedBuildActionWrapper =
            mock(PromotionStatusProvider.PromotedBuildActionWrapper.class);
    when(mockPromotedBuildActionWrapper.getPromotions(anyObject())).thenReturn(mockPromotionList);

    final PromotionStatusProvider promotionStatusProvider = new PromotionStatusProvider();
    promotionStatusProvider.setPromotedBuildActionWrapper(mockPromotedBuildActionWrapper);

    final boolean isPromoted = promotionStatusProvider.isBuildPromoted(mockBuild);
    assertTrue(isPromoted);
}
项目:github-integration-plugin    文件:JobHelper.java   
public static boolean rebuild(Run<?, ?> run) {
    final QueueTaskFuture queueTaskFuture = asParameterizedJobMixIn(run.getParent())
            .scheduleBuild2(
                    0,
                    run.getAction(ParametersAction.class),
                    run.getAction(CauseAction.class),
                    run.getAction(BuildBadgeAction.class)
            );
    return queueTaskFuture != null;
}