Package org.springframework.mock.web
Class MockPart
- java.lang.Object
- org.springframework.mock.web.MockPart
- All Implemented Interfaces:
Part
public class MockPart extends Object implements Part
Mock implementation ofjavax.servlet.http.Part
.- Since:
- 4.3.12
- Author:
- Rossen Stoyanchev, Juergen Hoeller
- See Also:
MockHttpServletRequest.addPart(javax.servlet.http.Part)
,MockMultipartFile
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
String
getContentType()
String
getHeader(String name)
Collection<String>
getHeaderNames()
HttpHeaders
getHeaders()
Return theHttpHeaders
backing header related accessor methods, allowing for populating selected header entries.Collection<String>
getHeaders(String name)
InputStream
getInputStream()
String
getName()
long
getSize()
String
getSubmittedFileName()
void
write(String fileName)
Constructor Detail
MockPart
public MockPart(String name, byte[] content)
Constructor for a part with byte[] content only.- See Also:
getHeaders()
MockPart
public MockPart(String name, String filename, byte[] content)
Constructor for a part with a filename and byte[] content.- See Also:
getHeaders()
Method Detail
getSubmittedFileName
public String getSubmittedFileName()
- Specified by:
getSubmittedFileName
in interfacePart
getContentType
public String getContentType()
- Specified by:
getContentType
in interfacePart
getInputStream
public InputStream getInputStream() throws IOException
- Specified by:
getInputStream
in interfacePart
- Throws:
IOException
write
public void write(String fileName) throws IOException
- Specified by:
write
in interfacePart
- Throws:
IOException
delete
public void delete() throws IOException
- Specified by:
delete
in interfacePart
- Throws:
IOException
getHeaders
public Collection<String> getHeaders(String name)
- Specified by:
getHeaders
in interfacePart
getHeaderNames
public Collection<String> getHeaderNames()
- Specified by:
getHeaderNames
in interfacePart
getHeaders
public final HttpHeaders getHeaders()
Return theHttpHeaders
backing header related accessor methods, allowing for populating selected header entries.