-
-
Notifications
You must be signed in to change notification settings - Fork 469
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
o Fixed implementation of BuildWithDetails.getCauses() to prevent NPE's.
- Loading branch information
1 parent
1ef87b6
commit a0feba2
Showing
5 changed files
with
119 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...cker/src/test/java/com/offbytwo/jenkins/integration/NoExecutorStartedGetJobDetailsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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(); | ||
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(); | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters