Updates for checkstyle
This commit is contained in:
@@ -23,6 +23,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -71,7 +72,7 @@ class BodyReader {
|
||||
private String byteBodyToAFileForTestMethod(SingleContractMetadata metadata, FromFileProperty property,
|
||||
CommunicationType side) {
|
||||
GeneratedClassDataForMethod classDataForMethod = classDataForMethod(metadata);
|
||||
String newFileName = classDataForMethod.getMethodName() + "_" + side.name().toLowerCase() + "_"
|
||||
String newFileName = classDataForMethod.getMethodName() + "_" + side.name().toLowerCase(Locale.ROOT) + "_"
|
||||
+ property.fileName();
|
||||
writeFileForBothIdeAndBuildTool(metadata, property.asBytes(), newFileName);
|
||||
return newFileName;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.contract.verifier.builder;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.cloud.contract.spec.internal.ExecutionProperty;
|
||||
import org.springframework.cloud.contract.spec.internal.Request;
|
||||
import org.springframework.cloud.contract.spec.internal.Url;
|
||||
@@ -51,7 +53,7 @@ class CustomModeMethodWithUrlGiven implements Given {
|
||||
|
||||
private void addUrl(Url buildUrl, Request request) {
|
||||
Object testSideUrl = MapConverter.getTestSideValues(buildUrl);
|
||||
String method = request.getMethod().getServerValue().toString().toLowerCase();
|
||||
String method = request.getMethod().getServerValue().toString().toLowerCase(Locale.ROOT);
|
||||
String url = testSideUrl.toString();
|
||||
if (!(testSideUrl instanceof ExecutionProperty)) {
|
||||
url = this.bodyParser.quotedShortText(testSideUrl.toString());
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.contract.verifier.builder;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.cloud.contract.spec.internal.ExecutionProperty;
|
||||
import org.springframework.cloud.contract.spec.internal.FromFileProperty;
|
||||
import org.springframework.cloud.contract.spec.internal.Request;
|
||||
@@ -43,7 +45,7 @@ class JaxRsRequestMethodWhen implements When, JaxRsBodyParser {
|
||||
void appendMethodAndBody(SingleContractMetadata metadata) {
|
||||
Request request = metadata.getContract().getRequest();
|
||||
ContentType type = metadata.getInputTestContentType();
|
||||
String method = request.getMethod().getServerValue().toString().toLowerCase();
|
||||
String method = request.getMethod().getServerValue().toString().toLowerCase(Locale.ROOT);
|
||||
if (request.getBody() != null) {
|
||||
String contentType = StringUtils.hasText(metadata.getDefinedInputTestContentType())
|
||||
? metadata.getDefinedInputTestContentType() : type.getMimeType();
|
||||
@@ -61,11 +63,11 @@ class JaxRsRequestMethodWhen implements When, JaxRsBodyParser {
|
||||
else {
|
||||
value = "\"" + requestBodyAsString(metadata) + "\"";
|
||||
}
|
||||
this.blockBuilder.addIndented(
|
||||
".build(\"" + method.toUpperCase() + "\", entity(" + value + ", \"" + contentType + "\"))");
|
||||
this.blockBuilder.addIndented(".build(\"" + method.toUpperCase(Locale.ROOT) + "\", entity(" + value + ", \""
|
||||
+ contentType + "\"))");
|
||||
}
|
||||
else {
|
||||
this.blockBuilder.addIndented(".build(\"" + method.toUpperCase() + "\")");
|
||||
this.blockBuilder.addIndented(".build(\"" + method.toUpperCase(Locale.ROOT) + "\")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.contract.verifier.builder;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.cloud.contract.spec.internal.ExecutionProperty;
|
||||
import org.springframework.cloud.contract.spec.internal.Request;
|
||||
import org.springframework.cloud.contract.spec.internal.Url;
|
||||
@@ -53,7 +55,7 @@ class MockMvcUrlWhen implements When, MockMvcAcceptor, QueryParamsResolver {
|
||||
|
||||
private void addUrl(Url buildUrl, Request request) {
|
||||
Object testSideUrl = MapConverter.getTestSideValues(buildUrl);
|
||||
String method = request.getMethod().getServerValue().toString().toLowerCase();
|
||||
String method = request.getMethod().getServerValue().toString().toLowerCase(Locale.ROOT);
|
||||
String url = testSideUrl.toString();
|
||||
if (!(testSideUrl instanceof ExecutionProperty)) {
|
||||
url = this.bodyParser.quotedShortText(testSideUrl.toString());
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -273,7 +274,7 @@ public class YamlContract {
|
||||
return Arrays.stream(values())
|
||||
.filter(matchingType -> matchingType.name()
|
||||
.replace("_", "")
|
||||
.equalsIgnoreCase(string.toLowerCase().replace("_", "")))
|
||||
.equalsIgnoreCase(string.toLowerCase(Locale.ROOT).replace("_", "")))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -78,7 +79,7 @@ public class OkHttpHttpVerifier implements HttpVerifier {
|
||||
}
|
||||
|
||||
private String url(Request request) {
|
||||
String url = request.scheme().name().toLowerCase() + ":" + this.hostAndPort
|
||||
String url = request.scheme().name().toLowerCase(Locale.ROOT) + ":" + this.hostAndPort
|
||||
+ (request.path().startsWith("/") ? request.path() : "/" + request.path());
|
||||
if (!request.queryParams().isEmpty()) {
|
||||
return url + "?"
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.AbstractMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.cloud.contract.spec.internal.HttpMethods;
|
||||
@@ -69,7 +70,7 @@ public class Request {
|
||||
public String contentType() {
|
||||
Object value = this.headers.entrySet()
|
||||
.stream()
|
||||
.filter(e -> e.getKey().toLowerCase().equals("content-type"))
|
||||
.filter(e -> e.getKey().toLowerCase(Locale.ROOT).equals("content-type"))
|
||||
.findFirst()
|
||||
.orElse(new AbstractMap.SimpleEntry<>("", null))
|
||||
.getValue();
|
||||
@@ -169,7 +170,7 @@ public class Request {
|
||||
* @return builder
|
||||
*/
|
||||
public Request.Builder method(String method, String path) {
|
||||
return new Request.Builder(HttpMethods.HttpMethod.valueOf(method.toUpperCase()), path);
|
||||
return new Request.Builder(HttpMethods.HttpMethod.valueOf(method.toUpperCase(Locale.ROOT)), path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.contract.verifier.messaging.stream;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -60,9 +61,9 @@ class DestinationResolver {
|
||||
log.debug("Found following channels [" + channels + "] for destination [" + destination + "]. "
|
||||
+ "Will pick the one that matches the default channel name or the first one if none is matching");
|
||||
}
|
||||
String defaultChannelName = channels.get(defaultChannel.name().toLowerCase());
|
||||
String defaultChannelName = channels.get(defaultChannel.name().toLowerCase(Locale.ROOT));
|
||||
String matchingChannelName = StringUtils.hasText(defaultChannelName)
|
||||
? defaultChannel.name().toLowerCase() : channels.keySet().iterator().next();
|
||||
? defaultChannel.name().toLowerCase(Locale.ROOT) : channels.keySet().iterator().next();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Picked channel name is [" + matchingChannelName + "]");
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A utility class that helps to convert names.
|
||||
@@ -104,7 +105,7 @@ public final class NamesUtil {
|
||||
if (isEmpty(className)) {
|
||||
return className;
|
||||
}
|
||||
String firstChar = className.substring(0, 1).toLowerCase();
|
||||
String firstChar = className.substring(0, 1).toLowerCase(Locale.ROOT);
|
||||
return firstChar + className.substring(1);
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ public final class NamesUtil {
|
||||
if (isEmpty(className)) {
|
||||
return className;
|
||||
}
|
||||
String firstChar = className.substring(0, 1).toUpperCase();
|
||||
String firstChar = className.substring(0, 1).toUpperCase(Locale.ROOT);
|
||||
return firstChar + className.substring(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user