hudson.tasks.Notifier Java Examples

The following examples show how to use hudson.tasks.Notifier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestUtility.java    From gitlab-plugin with GNU General Public License v2.0 5 votes vote down vote up
static <T  extends Notifier & MatrixAggregatable> void verifyMatrixAggregatable(Class<T> publisherClass, BuildListener listener) throws InterruptedException, IOException {
    AbstractBuild build = mock(AbstractBuild.class);
    AbstractProject project = mock(MatrixConfiguration.class);
    Notifier publisher = mock(publisherClass);
    MatrixBuild parentBuild = mock(MatrixBuild.class);

    when(build.getParent()).thenReturn(project);
    when(((MatrixAggregatable) publisher).createAggregator(any(MatrixBuild.class), any(Launcher.class), any(BuildListener.class))).thenCallRealMethod();
    when(publisher.perform(any(AbstractBuild.class), any(Launcher.class), any(BuildListener.class))).thenReturn(true);

    MatrixAggregator aggregator = ((MatrixAggregatable) publisher).createAggregator(parentBuild, null, listener);
    aggregator.startBuild();
    aggregator.endBuild();
    verify(publisher).perform(parentBuild, null, listener);
}