Bumping versions
This commit is contained in:
@@ -40,10 +40,11 @@ import java.util.stream.Collectors;
|
||||
public class Common {
|
||||
|
||||
public Map<String, DslProperty> convertObjectsToDslProperties(Map<String, Object> body) {
|
||||
return body.entrySet().stream()
|
||||
.collect(Collectors.toMap((Function<Map.Entry, String>) t -> t.getKey().toString(),
|
||||
(Function<Map.Entry, DslProperty>) t -> toDslProperty(t.getValue()), throwingMerger(),
|
||||
LinkedHashMap::new));
|
||||
return body.entrySet()
|
||||
.stream()
|
||||
.collect(Collectors.toMap((Function<Map.Entry, String>) t -> t.getKey().toString(),
|
||||
(Function<Map.Entry, DslProperty>) t -> toDslProperty(t.getValue()), throwingMerger(),
|
||||
LinkedHashMap::new));
|
||||
}
|
||||
|
||||
private static <T> BinaryOperator<T> throwingMerger() {
|
||||
|
||||
@@ -37,10 +37,10 @@ import java.util.regex.Pattern;
|
||||
public class Headers {
|
||||
|
||||
private static final BiFunction<String, Header, Object> CLIENT_SIDE = (s, header) -> ContractUtils
|
||||
.convertStubSideRecursively(header);
|
||||
.convertStubSideRecursively(header);
|
||||
|
||||
private static final BiFunction<String, Header, Object> SERVER_SIDE = (s, header) -> ContractUtils
|
||||
.convertTestSideRecursively(header);
|
||||
.convertTestSideRecursively(header);
|
||||
|
||||
private Set<Header> entries = new LinkedHashSet<>();
|
||||
|
||||
|
||||
@@ -68,16 +68,16 @@ public final class RegexPatterns {
|
||||
protected static final Pattern HTTPS_URL = UrlHelper.HTTPS_URL;
|
||||
|
||||
protected static final Pattern UUID = Pattern
|
||||
.compile("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}", Pattern.CASE_INSENSITIVE);
|
||||
.compile("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
protected static final Pattern UUID4 = Pattern
|
||||
.compile("[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}", Pattern.CASE_INSENSITIVE);
|
||||
.compile("[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
protected static final Pattern ANY_DATE = Pattern
|
||||
.compile("(\\d\\d\\d\\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])");
|
||||
.compile("(\\d\\d\\d\\d)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])");
|
||||
|
||||
protected static final Pattern ANY_DATE_TIME = Pattern.compile(
|
||||
"([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])");
|
||||
protected static final Pattern ANY_DATE_TIME = Pattern
|
||||
.compile("([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])");
|
||||
|
||||
protected static final Pattern ANY_TIME = Pattern.compile("(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])");
|
||||
|
||||
@@ -89,9 +89,9 @@ public final class RegexPatterns {
|
||||
"([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\\.\\d+)?(Z|[+-][01]\\d:[0-5]\\d)");
|
||||
|
||||
protected static Pattern anyOf(String... values) {
|
||||
return Pattern
|
||||
.compile(Arrays.stream(values).map(it -> '^' + RegexpUtils.escapeSpecialRegexWithSingleEscape(it) + '$')
|
||||
.collect(Collectors.joining("|")));
|
||||
return Pattern.compile(Arrays.stream(values)
|
||||
.map(it -> '^' + RegexpUtils.escapeSpecialRegexWithSingleEscape(it) + '$')
|
||||
.collect(Collectors.joining("|")));
|
||||
}
|
||||
|
||||
public static String multipartParam(Object name, Object value) {
|
||||
|
||||
@@ -742,8 +742,8 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
|
||||
@Override
|
||||
public DslProperty matching(final String value) {
|
||||
return this.common.$(
|
||||
this.common.p(
|
||||
notEscaped(Pattern.compile(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*"))),
|
||||
this.common
|
||||
.p(notEscaped(Pattern.compile(RegexpUtils.escapeSpecialRegexWithSingleEscape(value) + ".*"))),
|
||||
this.common.c(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ public class Xeger {
|
||||
assert random != null;
|
||||
// https://stackoverflow.com/questions/1578789/how-do-i-generate-text-matching-a-regular-expression-from-a-regular-expression
|
||||
String pattern = regex.replace("\\d", "[0-9]") // Used d=Digit
|
||||
.replace("\\w", "[A-Za-z0-9_]") // Used =Word
|
||||
.replace("\\s", "[ \t\r\n]"); // Used s="White"Space
|
||||
.replace("\\w", "[A-Za-z0-9_]") // Used =Word
|
||||
.replace("\\s", "[ \t\r\n]"); // Used s="White"Space
|
||||
this.automaton = new RegExp(pattern).toAutomaton();
|
||||
this.random = random;
|
||||
String generatedCharsSysProp = System.getProperty("springCloudContractGeneratedCharsFromRegex");
|
||||
|
||||
Reference in New Issue
Block a user