Polishing
This commit is contained in:
parent
2f85cbf0d9
commit
9aaed2bcef
|
|
@ -259,7 +259,8 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
|
|||
}
|
||||
else {
|
||||
Assert.isTrue(uriComponents.getPath().startsWith(this.contextPath),
|
||||
() -> uriComponents.getPath() + " should start with contextPath " + this.contextPath);
|
||||
() -> "\"" + uriComponents.getPath() +
|
||||
"\" should start with context path \"" + this.contextPath + "\"");
|
||||
request.setContextPath(this.contextPath);
|
||||
}
|
||||
}
|
||||
|
|
@ -273,7 +274,8 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
|
|||
while (tokens.hasMoreTokens()) {
|
||||
String cookieName = tokens.nextToken().trim();
|
||||
Assert.isTrue(tokens.hasMoreTokens(),
|
||||
() -> "Expected value for cookie name '" + cookieName + "'. Full cookie was " + cookieHeaderValue);
|
||||
() -> "Expected value for cookie name '" + cookieName +
|
||||
"': full cookie header was [" + cookieHeaderValue + "]");
|
||||
String cookieValue = tokens.nextToken().trim();
|
||||
processCookie(request, cookies, new Cookie(cookieName, cookieValue));
|
||||
}
|
||||
|
|
@ -384,7 +386,7 @@ final class HtmlUnitRequestBuilder implements RequestBuilder, Mergeable {
|
|||
|
||||
private Locale parseLocale(String locale) {
|
||||
Matcher matcher = LOCALE_PATTERN.matcher(locale);
|
||||
Assert.isTrue(matcher.matches(), () -> "Invalid locale " + locale);
|
||||
Assert.isTrue(matcher.matches(), () -> "Invalid locale value [" + locale + "]");
|
||||
String language = matcher.group(1);
|
||||
String country = matcher.group(2);
|
||||
if (country == null) {
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ public class RestTemplateIntegrationTests extends AbstractMockWebServerTestCase
|
|||
public ClientHttpRequestFactory clientHttpRequestFactory;
|
||||
|
||||
@Parameters
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Iterable<? extends ClientHttpRequestFactory> data() {
|
||||
return Arrays.asList(
|
||||
new SimpleClientHttpRequestFactory(),
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ public class RestTemplateTests {
|
|||
verify(response).close();
|
||||
}
|
||||
|
||||
@Test // SPR-15201
|
||||
@Test // SPR-15201
|
||||
public void uriTemplateWithTrailingSlash() throws Exception {
|
||||
String url = "http://example.com/spring/";
|
||||
given(requestFactory.createRequest(new URI(url), HttpMethod.GET)).willReturn(request);
|
||||
|
|
@ -280,7 +280,6 @@ public class RestTemplateTests {
|
|||
|
||||
@Test
|
||||
public void getForObjectWithCustomUriTemplateHandler() throws Exception {
|
||||
|
||||
DefaultUriBuilderFactory uriTemplateHandler = new DefaultUriBuilderFactory();
|
||||
template.setUriTemplateHandler(uriTemplateHandler);
|
||||
|
||||
|
|
@ -306,7 +305,6 @@ public class RestTemplateTests {
|
|||
verify(response).close();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void headForHeaders() throws Exception {
|
||||
given(requestFactory.createRequest(new URI("http://example.com"), HttpMethod.HEAD)).willReturn(request);
|
||||
|
|
|
|||
Loading…
Reference in New Issue