Skip to content

Commit

Permalink
Merged in PR serenity-bdd#1638
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Jun 6, 2019
1 parent 9d7f7a7 commit b04c2c3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ public String getNamedUrl(final String name,
private String urlWithParametersSubstituted(final String template,
final String[] parameterValues) {

String url = template;
String url = addBaseUrlTo(template);
for (int i = 0; i < parameterValues.length; i++) {
String variable = String.format("{%d}", i + 1);
url = url.replace(variable, parameterValues[i]);
}
return addBaseUrlTo(url);
// return addBaseUrlTo(url);
return url;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ public String getProperty(String propertyName) {
return substituteProperties(propertyValue);
}

private final Pattern VARIABLE_EXPRRESSION_PATTERN = Pattern.compile("#\\{(.*)\\}");
//private final Pattern VARIABLE_EXPRRESSION_PATTERN = Pattern.compile("#\\{(.*)\\}");
private final Pattern VARIABLE_EXPRESSION_PATTERN = Pattern.compile("#\\{([^}]*)\\}");

private String substituteProperties(String propertyValue) {
if (propertyValue == null) { return propertyValue; }

Matcher matcher = VARIABLE_EXPRRESSION_PATTERN.matcher(propertyValue);
Matcher matcher = VARIABLE_EXPRESSION_PATTERN.matcher(propertyValue);
while (matcher.find()) {
String nestedProperty = matcher.group().substring(2,matcher.group().length() - 1);
String value = getPropertyValue(nestedProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,12 @@ public boolean containsTag(TestTag testTag) {
return getTags().contains(testTag);
}

public boolean containsTagMatching(TestTag containedTag) {
return getTags().stream().anyMatch(
tag -> tag.isAsOrMoreSpecificThan(containedTag) || containedTag.isAsOrMoreSpecificThan(tag)
);
}

public Optional<ZonedDateTime> getStartTime() {
return outcomes.stream()
.filter(outcome -> outcome.getStartTime() != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public List<RequirementOutcome> geLeafRequirementOutcomes(List<RequirementOutcom
}

public List<RequirementOutcome> getFlattenedRequirementOutcomes(List<RequirementOutcome> outcomes) {
Set<RequirementOutcome> flattenedOutcomes = new HashSet();
Set<RequirementOutcome> flattenedOutcomes = new HashSet<>();

for (RequirementOutcome requirementOutcome : outcomes) {
flattenedOutcomes.add(requirementOutcome);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.thucydides.core.reports.ReportOptions;
import net.thucydides.core.reports.TestOutcomes;
import net.thucydides.core.requirements.RequirementsService;
import net.thucydides.core.requirements.reports.RequirementsOutcomes;
import net.thucydides.core.requirements.reports.ScenarioOutcome;
import net.thucydides.core.requirements.reports.ScenarioOutcomes;
import net.thucydides.core.util.EnvironmentVariables;
Expand Down Expand Up @@ -123,10 +124,14 @@ public Map<String, Object> getBuildContext(TestOutcomes testOutcomes,

context.put("inflection", Inflector.getInstance());

Collection<TestTag> coveredTags = requirements.getTagsOfType(tagTypes);
Collection<TestTag> coveredTags = requirements.getTagsOfType(tagTypes).stream()
.filter(tag -> testOutcomes.containsTagMatching(tag))
.collect(Collectors.toSet());

context.put("coverage", TagCoverage.from(testOutcomes)//.withTags(coveredTags))
.showingTags(requirements.getTagsOfType(tagTypes))

context.put("coverage", TagCoverage.from(testOutcomes)
// .showingTags(requirements.getTagsOfType(tagTypes))
.showingTags(coveredTags)
.forTagTypes(tagTypes));
context.put("backgroundColor", new BackgroundColor());

Expand Down

0 comments on commit b04c2c3

Please sign in to comment.