Skip to content

Commit 7f7c0d5

Browse files
committed
Merge branch '6.1.x'
2 parents 7d4db43 + f5a3658 commit 7f7c0d5

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

framework-platform/framework-platform.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ dependencies {
2525

2626
constraints {
2727
api("com.fasterxml:aalto-xml:1.3.2")
28-
api("com.fasterxml.woodstox:woodstox-core:6.5.1")
28+
api("com.fasterxml.woodstox:woodstox-core:6.6.1")
2929
api("com.github.ben-manes.caffeine:caffeine:3.1.8")
3030
api("com.github.librepdf:openpdf:1.3.42")
3131
api("com.google.code.findbugs:findbugs:3.0.1")
3232
api("com.google.code.findbugs:jsr305:3.0.2")
3333
api("com.google.code.gson:gson:2.10.1")
34-
api("com.google.protobuf:protobuf-java-util:3.25.2")
34+
api("com.google.protobuf:protobuf-java-util:3.25.3")
3535
api("com.h2database:h2:2.2.224")
36-
api("com.jayway.jsonpath:json-path:2.8.0")
36+
api("com.jayway.jsonpath:json-path:2.9.0")
3737
api("com.rometools:rome:1.19.0")
3838
api("com.squareup.okhttp3:mockwebserver:3.14.9")
3939
api("com.squareup.okhttp3:okhttp:3.14.9")
@@ -42,7 +42,7 @@ dependencies {
4242
api("com.sun.xml.bind:jaxb-core:3.0.2")
4343
api("com.sun.xml.bind:jaxb-impl:3.0.2")
4444
api("com.sun.xml.bind:jaxb-xjc:3.0.2")
45-
api("com.thoughtworks.qdox:qdox:2.0.3")
45+
api("com.thoughtworks.qdox:qdox:2.1.0")
4646
api("com.thoughtworks.xstream:xstream:1.4.20")
4747
api("commons-io:commons-io:2.15.0")
4848
api("de.bechte.junit:junit-hierarchicalcontextrunner:4.12.2")

spring-web/src/test/java/org/springframework/web/util/UriTemplateTests.java

+30
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,27 @@ void getVariableNames() {
5353
assertThat(variableNames).as("Invalid variable names").isEqualTo(Arrays.asList("hotel", "booking"));
5454
}
5555

56+
@Test
57+
void getVariableNamesFromEmpty() {
58+
UriTemplate template = new UriTemplate("");
59+
List<String> variableNames = template.getVariableNames();
60+
assertThat(variableNames).isEmpty();
61+
}
62+
5663
@Test
5764
void expandVarArgs() {
5865
UriTemplate template = new UriTemplate("/hotels/{hotel}/bookings/{booking}");
5966
URI result = template.expand("1", "42");
6067
assertThat(result).as("Invalid expanded template").isEqualTo(URI.create("/hotels/1/bookings/42"));
6168
}
6269

70+
@Test
71+
void expandVarArgsFromEmpty() {
72+
UriTemplate template = new UriTemplate("");
73+
URI result = template.expand();
74+
assertThat(result).as("Invalid expanded template").isEqualTo(URI.create(""));
75+
}
76+
6377
@Test // SPR-9712
6478
void expandVarArgsWithArrayValue() {
6579
UriTemplate template = new UriTemplate("/sum?numbers={numbers}");
@@ -135,6 +149,15 @@ void matches() {
135149
assertThat(template.matches(null)).as("UriTemplate matches").isFalse();
136150
}
137151

152+
@Test
153+
void matchesAgainstEmpty() {
154+
UriTemplate template = new UriTemplate("");
155+
assertThat(template.matches("/hotels/1/bookings/42")).as("UriTemplate matches").isFalse();
156+
assertThat(template.matches("/hotels/bookings")).as("UriTemplate matches").isFalse();
157+
assertThat(template.matches("")).as("UriTemplate does not match").isTrue();
158+
assertThat(template.matches(null)).as("UriTemplate matches").isFalse();
159+
}
160+
138161
@Test
139162
void matchesCustomRegex() {
140163
UriTemplate template = new UriTemplate("/hotels/{hotel:\\d+}");
@@ -153,6 +176,13 @@ void match() {
153176
assertThat(result).as("Invalid match").isEqualTo(expected);
154177
}
155178

179+
@Test
180+
void matchAgainstEmpty() {
181+
UriTemplate template = new UriTemplate("");
182+
Map<String, String> result = template.match("/hotels/1/bookings/42");
183+
assertThat(result).as("Invalid match").isEmpty();
184+
}
185+
156186
@Test
157187
void matchCustomRegex() {
158188
Map<String, String> expected = new HashMap<>(2);

0 commit comments

Comments
 (0)