Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Use Locale.ROOT when transforming case of identifiers #1484

Merged
merged 1 commit into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/src/main/java/cucumber/api/HookType.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package cucumber.api;

import static java.util.Locale.ROOT;

public enum HookType {
Before, After, BeforeStep, AfterStep;

@Override
public String toString() {
return super.toString().toLowerCase();
return super.toString().toLowerCase(ROOT);
}
}
7 changes: 4 additions & 3 deletions core/src/main/java/cucumber/api/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Comparator;
import java.util.Objects;

import static java.util.Locale.ROOT;
import static java.util.Objects.requireNonNull;

public final class Result {
Expand All @@ -30,15 +31,15 @@ public enum Type {
FAILED;

public static Type fromLowerCaseName(String lowerCaseName) {
return valueOf(lowerCaseName.toUpperCase());
return valueOf(lowerCaseName.toUpperCase(ROOT));
}

public String lowerCaseName() {
return name().toLowerCase();
return name().toLowerCase(ROOT);
}

public String firstLetterCapitalizedName() {
return name().substring(0, 1) + name().substring(1).toLowerCase();
return name().substring(0, 1) + name().substring(1).toLowerCase(ROOT);
}


Expand Down
6 changes: 4 additions & 2 deletions core/src/main/java/cucumber/runtime/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.Properties;
import java.util.ResourceBundle;

import static java.util.Locale.ROOT;

/**
* Looks up values in the following order:
* <ol>
Expand Down Expand Up @@ -56,8 +58,8 @@ public Env(String bundleName, Properties properties) {
private void put(String key, String string) {
map.put(key, string);
// Support old skool
map.put(key.replace('.', '_').toUpperCase(), string);
map.put(key.replace('_', '.').toLowerCase(), string);
map.put(key.replace('.', '_').toUpperCase(ROOT), string);
map.put(key.replace('_', '.').toLowerCase(ROOT), string);
}

public String get(String key) {
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/java/cucumber/util/Encoding.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static java.util.Locale.ROOT;

/**
* Utilities for reading the encoding of a file.
*/
Expand Down Expand Up @@ -36,6 +38,6 @@ private static String encoding(String source) {
break;
}
}
return encoding.toUpperCase();
return encoding.toUpperCase(ROOT);
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package cucumber.runtime.junit;

import static java.util.Locale.ROOT;

public enum NotificationLevel {
SCENARIO,
STEP;

String lowerCaseName() {
return name().toLowerCase();
return name().toLowerCase(ROOT);
}
}