diff --git a/spring-test/src/main/java/org/springframework/test/web/client/MockMvcClientHttpRequestFactory.java b/spring-test/src/main/java/org/springframework/test/web/client/MockMvcClientHttpRequestFactory.java index e5ab9c666a..42c7a03cef 100644 --- a/spring-test/src/main/java/org/springframework/test/web/client/MockMvcClientHttpRequestFactory.java +++ b/spring-test/src/main/java/org/springframework/test/web/client/MockMvcClientHttpRequestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public class MockMvcClientHttpRequestFactory @Override - public ClientHttpRequest createRequest(final URI uri, final HttpMethod httpMethod) { + public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) { return new MockClientHttpRequest(httpMethod, uri) { @Override public ClientHttpResponse executeInternal() throws IOException { diff --git a/spring-test/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java b/spring-test/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java index 13b652b850..451875dfff 100644 --- a/spring-test/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/client/match/ContentRequestMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,7 +74,7 @@ public class ContentRequestMatchers { /** * Assert the request content type as a {@link MediaType}. */ - public RequestMatcher contentType(final MediaType expectedContentType) { + public RequestMatcher contentType(MediaType expectedContentType) { return request -> { MediaType actualContentType = request.getHeaders().getContentType(); assertTrue("Content type not set", actualContentType != null); @@ -94,7 +94,7 @@ public class ContentRequestMatchers { * Assert the request content type is compatible with the given * content type as defined by {@link MediaType#isCompatibleWith(MediaType)}. */ - public RequestMatcher contentTypeCompatibleWith(final MediaType contentType) { + public RequestMatcher contentTypeCompatibleWith(MediaType contentType) { return request -> { MediaType actualContentType = request.getHeaders().getContentType(); assertTrue("Content type not set", actualContentType != null); @@ -108,7 +108,7 @@ public class ContentRequestMatchers { /** * Get the body of the request as a UTF-8 string and apply the given {@link Matcher}. */ - public RequestMatcher string(final Matcher matcher) { + public RequestMatcher string(Matcher matcher) { return request -> { MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; assertThat("Request content", mockRequest.getBodyAsString(), matcher); @@ -118,7 +118,7 @@ public class ContentRequestMatchers { /** * Get the body of the request as a UTF-8 string and compare it to the given String. */ - public RequestMatcher string(final String expectedContent) { + public RequestMatcher string(String expectedContent) { return request -> { MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; assertEquals("Request content", expectedContent, mockRequest.getBodyAsString()); @@ -128,7 +128,7 @@ public class ContentRequestMatchers { /** * Compare the body of the request to the given byte array. */ - public RequestMatcher bytes(final byte[] expectedContent) { + public RequestMatcher bytes(byte[] expectedContent) { return request -> { MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; assertEquals("Request content", expectedContent, mockRequest.getBodyAsBytes()); @@ -139,7 +139,7 @@ public class ContentRequestMatchers { * Parse the body as form data and compare to the given {@code MultiValueMap}. * @since 4.3 */ - public RequestMatcher formData(final MultiValueMap expectedContent) { + public RequestMatcher formData(MultiValueMap expectedContent) { return request -> { HttpInputMessage inputMessage = new HttpInputMessage() { @Override @@ -165,7 +165,7 @@ public class ContentRequestMatchers { * XMLUnit library is available. * @param expectedXmlContent the expected XML content */ - public RequestMatcher xml(final String expectedXmlContent) { + public RequestMatcher xml(String expectedXmlContent) { return new AbstractXmlRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -177,7 +177,7 @@ public class ContentRequestMatchers { /** * Parse the request content as {@link Node} and apply the given {@link Matcher}. */ - public RequestMatcher node(final Matcher matcher) { + public RequestMatcher node(Matcher matcher) { return new AbstractXmlRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -190,7 +190,7 @@ public class ContentRequestMatchers { * Parse the request content as {@link DOMSource} and apply the given {@link Matcher}. * @see https://code.google.com/p/xml-matchers/ */ - public RequestMatcher source(final Matcher matcher) { + public RequestMatcher source(Matcher matcher) { return new AbstractXmlRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -209,7 +209,7 @@ public class ContentRequestMatchers { * @param expectedJsonContent the expected JSON content * @since 5.0.5 */ - public RequestMatcher json(final String expectedJsonContent) { + public RequestMatcher json(String expectedJsonContent) { return json(expectedJsonContent, false); } @@ -228,7 +228,7 @@ public class ContentRequestMatchers { * @param strict enables strict checking * @since 5.0.5 */ - public RequestMatcher json(final String expectedJsonContent, final boolean strict) { + public RequestMatcher json(String expectedJsonContent, boolean strict) { return request -> { try { MockClientHttpRequest mockRequest = (MockClientHttpRequest) request; diff --git a/spring-test/src/main/java/org/springframework/test/web/client/match/JsonPathRequestMatchers.java b/spring-test/src/main/java/org/springframework/test/web/client/match/JsonPathRequestMatchers.java index 85a16ddfdd..78b2d21dbe 100644 --- a/spring-test/src/main/java/org/springframework/test/web/client/match/JsonPathRequestMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/client/match/JsonPathRequestMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,7 +61,7 @@ public class JsonPathRequestMatchers { * Evaluate the JSON path expression against the request content and * assert the resulting value with the given Hamcrest {@link Matcher}. */ - public RequestMatcher value(final Matcher matcher) { + public RequestMatcher value(Matcher matcher) { return new AbstractJsonPathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws IOException, ParseException { @@ -78,7 +78,7 @@ public class JsonPathRequestMatchers { * to coerce an integer into a double. * @since 4.3.3 */ - public RequestMatcher value(final Matcher matcher, final Class targetType) { + public RequestMatcher value(Matcher matcher, Class targetType) { return new AbstractJsonPathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws IOException, ParseException { @@ -92,7 +92,7 @@ public class JsonPathRequestMatchers { * Evaluate the JSON path expression against the request content and * assert that the result is equal to the supplied value. */ - public RequestMatcher value(final Object expectedValue) { + public RequestMatcher value(Object expectedValue) { return new AbstractJsonPathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws IOException, ParseException { diff --git a/spring-test/src/main/java/org/springframework/test/web/client/match/MockRestRequestMatchers.java b/spring-test/src/main/java/org/springframework/test/web/client/match/MockRestRequestMatchers.java index 3b068dc1ea..38b6860920 100644 --- a/spring-test/src/main/java/org/springframework/test/web/client/match/MockRestRequestMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/client/match/MockRestRequestMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ public abstract class MockRestRequestMatchers { * @param method the HTTP method * @return the request matcher */ - public static RequestMatcher method(final HttpMethod method) { + public static RequestMatcher method(HttpMethod method) { Assert.notNull(method, "'method' must not be null"); return request -> assertEquals("Unexpected HttpMethod", method, request.getMethod()); } @@ -72,7 +72,7 @@ public abstract class MockRestRequestMatchers { * @param matcher the String matcher for the expected URI * @return the request matcher */ - public static RequestMatcher requestTo(final Matcher matcher) { + public static RequestMatcher requestTo(Matcher matcher) { Assert.notNull(matcher, "'matcher' must not be null"); return request -> assertThat("Request URI", request.getURI().toString(), matcher); } @@ -82,7 +82,7 @@ public abstract class MockRestRequestMatchers { * @param expectedUri the expected URI * @return the request matcher */ - public static RequestMatcher requestTo(final String expectedUri) { + public static RequestMatcher requestTo(String expectedUri) { Assert.notNull(expectedUri, "'uri' must not be null"); return request -> assertEquals("Request URI", expectedUri, request.getURI().toString()); } @@ -95,7 +95,7 @@ public abstract class MockRestRequestMatchers { * @param uriVars zero or more URI variables to populate the expected URI * @return the request matcher */ - public static RequestMatcher requestToUriTemplate(final String expectedUri, final Object... uriVars) { + public static RequestMatcher requestToUriTemplate(String expectedUri, Object... uriVars) { Assert.notNull(expectedUri, "'uri' must not be null"); URI uri = UriComponentsBuilder.fromUriString(expectedUri).buildAndExpand(uriVars).encode().toUri(); return requestTo(uri); @@ -106,7 +106,7 @@ public abstract class MockRestRequestMatchers { * @param uri the expected URI * @return the request matcher */ - public static RequestMatcher requestTo(final URI uri) { + public static RequestMatcher requestTo(URI uri) { Assert.notNull(uri, "'uri' must not be null"); return request -> assertEquals("Unexpected request", uri, request.getURI()); } @@ -115,7 +115,7 @@ public abstract class MockRestRequestMatchers { * Assert request query parameter values with the given Hamcrest matcher(s). */ @SafeVarargs - public static RequestMatcher queryParam(final String name, final Matcher... matchers) { + public static RequestMatcher queryParam(String name, Matcher... matchers) { return request -> { MultiValueMap params = getQueryParams(request); assertValueCount("query param", name, params, matchers.length); @@ -128,7 +128,7 @@ public abstract class MockRestRequestMatchers { /** * Assert request query parameter values. */ - public static RequestMatcher queryParam(final String name, final String... expectedValues) { + public static RequestMatcher queryParam(String name, String... expectedValues) { return request -> { MultiValueMap params = getQueryParams(request); assertValueCount("query param", name, params, expectedValues.length); @@ -143,7 +143,7 @@ public abstract class MockRestRequestMatchers { } private static void assertValueCount( - String valueType, final String name, MultiValueMap map, int count) { + String valueType, String name, MultiValueMap map, int count) { List values = map.get(name); String message = "Expected " + valueType + " <" + name + ">"; @@ -159,7 +159,7 @@ public abstract class MockRestRequestMatchers { * Assert request header values with the given Hamcrest matcher(s). */ @SafeVarargs - public static RequestMatcher header(final String name, final Matcher... matchers) { + public static RequestMatcher header(String name, Matcher... matchers) { return request -> { assertValueCount("header", name, request.getHeaders(), matchers.length); List headerValues = request.getHeaders().get(name); @@ -173,7 +173,7 @@ public abstract class MockRestRequestMatchers { /** * Assert request header values. */ - public static RequestMatcher header(final String name, final String... expectedValues) { + public static RequestMatcher header(String name, String... expectedValues) { return request -> { assertValueCount("header", name, request.getHeaders(), expectedValues.length); List headerValues = request.getHeaders().get(name); diff --git a/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java b/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java index dce4dac8e1..9ec17572b7 100644 --- a/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java +++ b/spring-test/src/main/java/org/springframework/test/web/client/match/XpathRequestMatchers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert it with the given {@code Matcher}. */ - public RequestMatcher node(final Matcher matcher) { + public RequestMatcher node(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -101,7 +101,7 @@ public class XpathRequestMatchers { * Apply the XPath and assert the number of nodes found with the given * {@code Matcher}. */ - public RequestMatcher nodeCount(final Matcher matcher) { + public RequestMatcher nodeCount(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -113,7 +113,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the number of nodes found. */ - public RequestMatcher nodeCount(final int expectedCount) { + public RequestMatcher nodeCount(int expectedCount) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -125,7 +125,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the String content found with the given matcher. */ - public RequestMatcher string(final Matcher matcher) { + public RequestMatcher string(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -137,7 +137,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the String content found. */ - public RequestMatcher string(final String value) { + public RequestMatcher string(String value) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -149,7 +149,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the number found with the given matcher. */ - public RequestMatcher number(final Matcher matcher) { + public RequestMatcher number(Matcher matcher) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -161,7 +161,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the number of nodes found. */ - public RequestMatcher number(final Double value) { + public RequestMatcher number(Double value) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception { @@ -173,7 +173,7 @@ public class XpathRequestMatchers { /** * Apply the XPath and assert the boolean value found. */ - public RequestMatcher booleanValue(final Boolean value) { + public RequestMatcher booleanValue(Boolean value) { return new AbstractXpathRequestMatcher() { @Override protected void matchInternal(MockClientHttpRequest request) throws Exception {