-
-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathNoExecutorStartedGetJobDetailsIT.java
More file actions
44 lines (32 loc) · 1.47 KB
/
NoExecutorStartedGetJobDetailsIT.java
File metadata and controls
44 lines (32 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.offbytwo.jenkins.integration;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import java.util.List;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.offbytwo.jenkins.model.BuildCause;
import com.offbytwo.jenkins.model.BuildWithDetails;
import com.offbytwo.jenkins.model.JobWithDetails;
@Test(groups = { Groups.NO_EXECUTOR_GROUP })
public class NoExecutorStartedGetJobDetailsIT extends AbstractJenkinsIntegrationCase {
private JobWithDetails job;
@BeforeMethod
public void beforeMethod() throws IOException {
job = jenkinsServer.getJob("test");
}
@Test
public void shouldCheckTheBuildCause() throws IOException {
BuildWithDetails details = job.getFirstBuild().details();
assertThat(details.getArtifacts()).isNotNull();
assertThat(details.getArtifacts().size()).isEqualTo(2);
details.getArtifacts().forEach(a -> assertThat(a.getClient()).isNotNull());
List<BuildCause> causes = details.getCauses();
assertThat(causes).hasSize(1);
BuildCause buildCause = causes.get(0);
assertThat(buildCause.getShortDescription()).isEqualTo("Started by user anonymous");
assertThat(buildCause.getUserName()).isEqualTo("anonymous");
assertThat(buildCause.getUpstreamBuild()).isEqualTo(0);
assertThat(buildCause.getUpstreamProject()).isNull();
assertThat(buildCause.getUserId()).isNull();
}
}