Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Updated android for the use of Gherkin v4.0.0.
- Loading branch information
1 parent
d66b876
commit de5fe34
Showing
9 changed files
with
246 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
android/src/main/java/cucumber/runtime/android/FeatureCompiler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cucumber.runtime.android; | ||
|
||
import cucumber.runtime.Runtime; | ||
import cucumber.runtime.model.CucumberFeature; | ||
import gherkin.pickles.Compiler; | ||
import gherkin.pickles.Pickle; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Utility class to count scenarios, including outlined. | ||
*/ | ||
public class FeatureCompiler { | ||
|
||
/** | ||
* Compilers the given {@code cucumberFeatures} to {@link Pickle}s. | ||
* | ||
* @param cucumberFeatures the list of {@link CucumberFeature} to compile | ||
* @return the compiled pickles in {@link PickleStruct}s | ||
*/ | ||
public static List<PickleStruct> compile(final List<CucumberFeature> cucumberFeatures, final Runtime runtime) { | ||
List<PickleStruct> pickles = new ArrayList<PickleStruct>(); | ||
Compiler compiler = new Compiler(); | ||
for (final CucumberFeature feature : cucumberFeatures) { | ||
for (final Pickle pickle : compiler.compile(feature.getGherkinFeature(), feature.getPath())) { | ||
if (runtime.matchesFilters(pickle)) { | ||
pickles.add(new PickleStruct(pickle, feature.getLanguage())); | ||
} | ||
} | ||
} | ||
return pickles; | ||
} | ||
|
||
} |
Oops, something went wrong.