|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -22,6 +22,7 @@ import java.io.InputStream; |
|
|
|
import java.io.StringReader; |
|
|
|
import java.io.StringReader; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import javax.xml.transform.Source; |
|
|
|
import javax.xml.transform.Source; |
|
|
|
import javax.xml.transform.stream.StreamSource; |
|
|
|
import javax.xml.transform.stream.StreamSource; |
|
|
|
|
|
|
|
|
|
|
|
@ -30,6 +31,7 @@ import org.apache.commons.fileupload.FileItemFactory; |
|
|
|
import org.apache.commons.fileupload.FileUpload; |
|
|
|
import org.apache.commons.fileupload.FileUpload; |
|
|
|
import org.apache.commons.fileupload.RequestContext; |
|
|
|
import org.apache.commons.fileupload.RequestContext; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory; |
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
|
|
@ -45,10 +47,14 @@ import org.springframework.util.LinkedMultiValueMap; |
|
|
|
import org.springframework.util.MultiValueMap; |
|
|
|
import org.springframework.util.MultiValueMap; |
|
|
|
|
|
|
|
|
|
|
|
import static org.hamcrest.CoreMatchers.*; |
|
|
|
import static org.hamcrest.CoreMatchers.*; |
|
|
|
import static org.hamcrest.CoreMatchers.endsWith; |
|
|
|
import static org.junit.Assert.assertEquals; |
|
|
|
import static org.hamcrest.CoreMatchers.startsWith; |
|
|
|
import static org.junit.Assert.assertFalse; |
|
|
|
import static org.junit.Assert.*; |
|
|
|
import static org.junit.Assert.assertNotNull; |
|
|
|
import static org.mockito.BDDMockito.*; |
|
|
|
import static org.junit.Assert.assertNull; |
|
|
|
|
|
|
|
import static org.junit.Assert.assertThat; |
|
|
|
|
|
|
|
import static org.junit.Assert.assertTrue; |
|
|
|
|
|
|
|
import static org.mockito.BDDMockito.never; |
|
|
|
|
|
|
|
import static org.mockito.BDDMockito.verify; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author Arjen Poutsma |
|
|
|
* @author Arjen Poutsma |
|
|
|
@ -116,8 +122,8 @@ public class FormHttpMessageConverterTests { |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("Invalid result", "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3", |
|
|
|
assertEquals("Invalid result", "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3", |
|
|
|
outputMessage.getBodyAsString(UTF_8)); |
|
|
|
outputMessage.getBodyAsString(UTF_8)); |
|
|
|
assertEquals("Invalid content-type", "application/x-www-form-urlencoded;charset=UTF-8", |
|
|
|
assertEquals("Invalid content-type", new MediaType("application", "x-www-form-urlencoded"), |
|
|
|
outputMessage.getHeaders().getContentType().toString()); |
|
|
|
outputMessage.getHeaders().getContentType()); |
|
|
|
assertEquals("Invalid content-length", outputMessage.getBodyAsBytes().length, |
|
|
|
assertEquals("Invalid content-length", outputMessage.getBodyAsBytes().length, |
|
|
|
outputMessage.getHeaders().getContentLength()); |
|
|
|
outputMessage.getHeaders().getContentLength()); |
|
|
|
} |
|
|
|
} |
|
|
|
|