Skip to content

Commit

Permalink
Merge pull request serenity-bdd#2067 from cliviu/master
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo authored May 8, 2020
2 parents 298465c + 26fe650 commit fcbcb27
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
public class TestTag implements Comparable<TestTag> {

public static final TestTag EMPTY_TAG = new TestTag("","");
public static final String DEFAULT_TAG_TYPE = "tag";

private final String name;
private final String type;
Expand Down Expand Up @@ -79,7 +80,7 @@ public static TestTag withValue(String value) {
} else if (value.contains("=")) {
return getTestTag(value, value.indexOf("="));
} else {
return TestTag.withName(value.trim()).andType("tag");
return TestTag.withName(value.trim()).andType(DEFAULT_TAG_TYPE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static net.thucydides.core.model.TestTag.DEFAULT_TAG_TYPE;
import static org.apache.commons.lang3.StringUtils.isEmpty;

/**
Expand Down Expand Up @@ -436,6 +437,12 @@ public Requirement withTags(List<TestTag> tags) {
}

public Requirement withScenarioTags(Map<String, Collection<TestTag>> scenarioTags) {
if(!tags.isEmpty() && this.scenarioTags.isEmpty()) {
List<TestTag> testTags = tags.stream().filter(testTag -> DEFAULT_TAG_TYPE.equals(testTag.getType())).collect(Collectors.toList());
for (Collection<TestTag> currentScenarioTag : scenarioTags.values()) {
currentScenarioTag.addAll(testTags);
}
}
return new Requirement(this.name, this.id, this.displayName, this.cardNumber, parent, this.type, this.path, this.narrative,
children, examples, releaseVersions, customFields, featureFileName, this.tags, scenarioTags, containsNoScenarios);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public void setJiraUsername(String jiraUsername) {
}

public void setTags(String tags) {
this.tags = tags;
this.tags = (tags != null) ? tags.replaceAll("\\s+((or)|(OR))\\s+",",") : null;
}

public void setJiraPassword(String jiraPassword) {
Expand Down

0 comments on commit fcbcb27

Please sign in to comment.