|
4 | 4 | import io.cucumber.core.eventbus.UuidGenerator;
|
5 | 5 | import io.cucumber.core.feature.FeatureWithLines;
|
6 | 6 | import io.cucumber.core.feature.GluePath;
|
7 |
| -import io.cucumber.core.logging.Logger; |
8 |
| -import io.cucumber.core.logging.LoggerFactory; |
9 | 7 | import io.cucumber.core.options.ObjectFactoryParser;
|
10 | 8 | import io.cucumber.core.options.PluginOption;
|
11 | 9 | import io.cucumber.core.options.SnippetTypeParser;
|
|
27 | 25 | import java.util.List;
|
28 | 26 | import java.util.Locale;
|
29 | 27 | import java.util.Optional;
|
30 |
| -import java.util.Random; |
31 | 28 | import java.util.Set;
|
32 | 29 | import java.util.function.UnaryOperator;
|
33 |
| -import java.util.regex.Matcher; |
34 | 30 | import java.util.regex.Pattern;
|
35 | 31 | import java.util.stream.Collectors;
|
36 | 32 |
|
@@ -61,7 +57,6 @@ class CucumberConfiguration implements
|
61 | 57 | io.cucumber.core.backend.Options,
|
62 | 58 | io.cucumber.core.eventbus.Options {
|
63 | 59 |
|
64 |
| - private static final Logger log = LoggerFactory.getLogger(CucumberConfiguration.class); |
65 | 60 | private final ConfigurationParameters configurationParameters;
|
66 | 61 |
|
67 | 62 | CucumberConfiguration(ConfigurationParameters configurationParameters) {
|
@@ -216,29 +211,7 @@ ExclusiveResourceConfiguration getExclusiveResourceConfiguration(String tag) {
|
216 | 211 | }
|
217 | 212 |
|
218 | 213 | UnaryOperator<List<AbstractCucumberTestDescriptor>> getOrderer() {
|
219 |
| - return configurationParameters.get(EXECUTION_ORDER_PROPERTY_NAME, order -> { |
220 |
| - if (order.equals("lexical")) { |
221 |
| - return StandardDescriptorOrders.lexicalUriOrder(); |
222 |
| - } |
223 |
| - if (order.equals("reverse")) { |
224 |
| - return StandardDescriptorOrders.reverseLexicalUriOrder(); |
225 |
| - } |
226 |
| - Pattern randomAndSeedPattern = Pattern.compile("random(?::(\\d+))?"); |
227 |
| - Matcher matcher = randomAndSeedPattern.matcher(order); |
228 |
| - if (!matcher.matches()) { |
229 |
| - throw new IllegalArgumentException("Invalid order. Must be either reverse, random or random:<long>"); |
230 |
| - } |
231 |
| - final long seed; |
232 |
| - String seedString = matcher.group(1); |
233 |
| - if (seedString != null) { |
234 |
| - seed = Long.parseLong(seedString); |
235 |
| - return StandardDescriptorOrders.random(seed); |
236 |
| - } else { |
237 |
| - seed = Math.abs(new Random().nextLong()); |
238 |
| - log.info(() -> "Using random test descriptor order. Seed: " + seed); |
239 |
| - return StandardDescriptorOrders.random(seed); |
240 |
| - } |
241 |
| - }) |
| 214 | + return configurationParameters.get(EXECUTION_ORDER_PROPERTY_NAME, StandardDescriptorOrders::parseOrderer) |
242 | 215 | .orElseGet(StandardDescriptorOrders::lexicalUriOrder);
|
243 | 216 | }
|
244 | 217 | }
|
0 commit comments