Polishing

This commit is contained in:
Sam Brannen 2016-05-04 16:04:37 +02:00
parent e6e3ca3e96
commit f09c7868d8
2 changed files with 6 additions and 5 deletions

View File

@ -335,7 +335,7 @@ public class MockHttpServletRequestBuilder
* @param sessionAttributes the session attributes * @param sessionAttributes the session attributes
*/ */
public MockHttpServletRequestBuilder sessionAttrs(Map<String, Object> sessionAttributes) { public MockHttpServletRequestBuilder sessionAttrs(Map<String, Object> sessionAttributes) {
Assert.notEmpty(sessionAttributes, "'sessionAttrs' must not be empty"); Assert.notEmpty(sessionAttributes, "'sessionAttributes' must not be empty");
for (String name : sessionAttributes.keySet()) { for (String name : sessionAttributes.keySet()) {
sessionAttr(name, sessionAttributes.get(name)); sessionAttr(name, sessionAttributes.get(name));
} }
@ -357,7 +357,7 @@ public class MockHttpServletRequestBuilder
* @param flashAttributes the flash attributes * @param flashAttributes the flash attributes
*/ */
public MockHttpServletRequestBuilder flashAttrs(Map<String, Object> flashAttributes) { public MockHttpServletRequestBuilder flashAttrs(Map<String, Object> flashAttributes) {
Assert.notEmpty(flashAttributes, "'flashAttrs' must not be empty"); Assert.notEmpty(flashAttributes, "'flashAttributes' must not be empty");
for (String name : flashAttributes.keySet()) { for (String name : flashAttributes.keySet()) {
flashAttr(name, flashAttributes.get(name)); flashAttr(name, flashAttributes.get(name));
} }
@ -708,7 +708,8 @@ public class MockHttpServletRequestBuilder
} }
private MultiValueMap<String, String> parseFormData(final MediaType mediaType) { private MultiValueMap<String, String> parseFormData(final MediaType mediaType) {
MultiValueMap<String, String> map;HttpInputMessage message = new HttpInputMessage() { MultiValueMap<String, String> map;
HttpInputMessage message = new HttpInputMessage() {
@Override @Override
public InputStream getBody() throws IOException { public InputStream getBody() throws IOException {
return new ByteArrayInputStream(content); return new ByteArrayInputStream(content);
@ -725,7 +726,7 @@ public class MockHttpServletRequestBuilder
map = new FormHttpMessageConverter().read(null, message); map = new FormHttpMessageConverter().read(null, message);
} }
catch (IOException ex) { catch (IOException ex) {
throw new IllegalStateException("Failed to parse form data in request body: ", ex); throw new IllegalStateException("Failed to parse form data in request body", ex);
} }
return map; return map;
} }

View File

@ -3433,7 +3433,7 @@ for the various `executeSqlScript(..)` methods for further details.
[[testcontext-executing-sql-declaratively]] [[testcontext-executing-sql-declaratively]]
===== Executing SQL scripts declaratively with `@Sql` ===== Executing SQL scripts declaratively with @Sql
In addition to the aforementioned mechanisms for executing SQL scripts In addition to the aforementioned mechanisms for executing SQL scripts
_programmatically_, SQL scripts can also be configured _declaratively_ in the Spring _programmatically_, SQL scripts can also be configured _declaratively_ in the Spring