Skip to content

Commit

Permalink
[Core] Change return value to reduce duplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
brasmusson committed Jul 25, 2017
1 parent 44fbd93 commit e52fc4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions core/src/main/java/cucumber/runtime/RuntimeOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,7 @@ public Map<String, List<Long>> getLineFilters(ResourceLoader resourceLoader) {
private void processRerunFiles(ResourceLoader resourceLoader) {
for (String featurePath : featurePaths) {
if (featurePath.startsWith("@")) {
for (String path : CucumberFeature.loadRerunFile(resourceLoader, featurePath.substring(1))) {
PathWithLines pathWithLines = new PathWithLines(path);
for (PathWithLines pathWithLines : CucumberFeature.loadRerunFile(resourceLoader, featurePath.substring(1))) {
addLineFilters(lineFilters, pathWithLines.path, pathWithLines.lines);
}
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/cucumber/runtime/model/CucumberFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ public static List<CucumberFeature> load(ResourceLoader resourceLoader, List<Str
}

private static void loadFromRerunFile(FeatureBuilder builder, ResourceLoader resourceLoader, String rerunPath) {
for(String path : loadRerunFile(resourceLoader, rerunPath)){
loadFromFileSystemOrClasspath(builder, resourceLoader, new PathWithLines(path).path);
for(PathWithLines pathWithLines : loadRerunFile(resourceLoader, rerunPath)){
loadFromFileSystemOrClasspath(builder, resourceLoader, pathWithLines.path);
}
}

public static List<String> loadRerunFile(ResourceLoader resourceLoader, String rerunPath) {
List<String> featurePaths = new ArrayList<String>();
public static List<PathWithLines> loadRerunFile(ResourceLoader resourceLoader, String rerunPath) {
List<PathWithLines> featurePaths = new ArrayList<PathWithLines>();
Iterable<Resource> resources = resourceLoader.resources(rerunPath, null);
for (Resource resource : resources) {
String source = read(resource);
if (!source.isEmpty()) {
Matcher matcher = RERUN_PATH_SPECIFICATION.matcher(source);
while(matcher.find()){
featurePaths.add(matcher.group(1));
featurePaths.add(new PathWithLines(matcher.group(1)));
}
}
}
Expand Down

0 comments on commit e52fc4f

Please sign in to comment.