Skip to content

Commit

Permalink
Improve "Build triggered/started" messages
Browse files Browse the repository at this point in the history
Previously, the messages were:

> Build triggered. sha1 is {merged,original commit}.

and, sic lack of full stop between the two sentences:

> Build started sha1 is {merged,original commit}.

Make these consistent, and clearer:

> Build {triggered,started} for {merge,original} commit.

and update the tests accordingly.
  • Loading branch information
wjt committed Jan 26, 2018
1 parent 43b329f commit f4fb361
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ public void onBuildTriggered(Job<?, ?> project,
if (!StringUtils.isEmpty(triggeredStatus)) {
sb.append(Ghprb.replaceMacros(project, triggeredStatus));
} else {
sb.append("Build triggered.");
sb.append("Build triggered");
if (isMergeable) {
sb.append(" sha1 is merged.");
sb.append(" for merge commit.");
} else {
sb.append(" sha1 is original commit.");
sb.append(" for original commit.");
}
}

Expand Down Expand Up @@ -184,7 +184,7 @@ public void onBuildStart(Run<?, ?> build,
if (StringUtils.isEmpty(startedStatus)) {
sb.append("Build started");
if (c != null) {
sb.append(c.isMerged() ? " sha1 is merged." : " sha1 is original commit.");
sb.append(c.isMerged() ? " for merge commit." : " for original commit.");
}
} else {
sb.append(Ghprb.replaceMacros(build, listener, startedStatus));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class GhprbRepositoryTest {

private static final Date UPDATE_DATE = new Date();

private static final String MSG = "Build triggered. sha1 is merged.";
private static final String MSG = "Build triggered for merge commit.";

@Mock
private GHRepository ghRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void setUp() throws Exception {

@Test
public void testMergedMessage() throws Exception {
String mergedMessage = "Build triggered. sha1 is merged.";
String mergedMessage = "Build triggered for merge commit.";
given(ghprbPullRequest.getHead()).willReturn("sha");
given(ghprbPullRequest.isMergeable()).willReturn(true);

Expand All @@ -56,7 +56,7 @@ public void testMergedMessage() throws Exception {

@Test
public void testMergeConflictMessage() throws Exception {
String mergedMessage = "Build triggered. sha1 is original commit.";
String mergedMessage = "Build triggered for original commit.";
given(ghprbPullRequest.getHead()).willReturn("sha");
given(ghprbPullRequest.isMergeable()).willReturn(false);

Expand All @@ -71,7 +71,7 @@ public void testMergeConflictMessage() throws Exception {

@Test
public void testDoesNotSendEmptyContext() throws Exception {
String mergedMessage = "Build triggered. sha1 is original commit.";
String mergedMessage = "Build triggered for original commit.";
given(ghprbPullRequest.getHead()).willReturn("sha");
given(ghprbPullRequest.isMergeable()).willReturn(false);

Expand Down

0 comments on commit f4fb361

Please sign in to comment.