Skip to content

Commit

Permalink
Merge pull request #253 from jglick/ShellStepTest.label
Browse files Browse the repository at this point in the history
Improve `ShellStepTest.label` with Hamcrest
  • Loading branch information
jglick authored Jul 19, 2022
2 parents c93d7d4 + c6bb73f commit 9af20dd
Showing 1 changed file with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,9 @@ private static class Decorator extends LauncherDecorator implements Serializable

WorkflowRun b = j.assertBuildStatus(Result.SUCCESS, p.scheduleBuild2(0).get());

boolean found = false;
FlowGraphTable t = new FlowGraphTable(b.getExecution());
t.build();
for (Row r : t.getRows()) {
if (r.getDisplayName().contains("Step with label")) {
found = true;
}
}

assertTrue(found);
assertThat(t.getRows().stream().map(Row::getDisplayName).toArray(String[]::new), hasItemInArray(containsString("Step with label")));
}

@Test public void labelShortened() throws Exception {
Expand All @@ -382,16 +375,9 @@ private static class Decorator extends LauncherDecorator implements Serializable

WorkflowRun b = j.assertBuildStatus(Result.SUCCESS, p.scheduleBuild2(0).get());

boolean found = false;
FlowGraphTable t = new FlowGraphTable(b.getExecution());
t.build();
for (Row r : t.getRows()) {
if (r.getDisplayName().contains(singleLabel)) {
found = true;
}
}

assertTrue(found);
assertThat(t.getRows().stream().map(Row::getDisplayName).toArray(String[]::new), hasItemInArray(containsString(singleLabel)));
}

@Issue("JENKINS-38381")
Expand Down

0 comments on commit 9af20dd

Please sign in to comment.