Package org.springframework.mock.web
Class MockPart
java.lang.Object
org.springframework.mock.web.MockPart
- All Implemented Interfaces:
 Part
Mock implementation of 
jakarta.servlet.http.Part.- Since:
 - 4.3.12
 - Author:
 - Rossen Stoyanchev, Juergen Hoeller
 - See Also:
 
- 
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a part with a name and content only.Constructor for a part with a name, filename, and content.Constructor for a part with a name, filename, content, and content type. - 
Method Summary
Modifier and TypeMethodDescriptionvoiddelete()final HttpHeadersReturn theHttpHeadersbacking header related accessor methods, allowing for populating selected header entries.getHeaders(String name) getName()longgetSize()void 
- 
Constructor Details
- 
MockPart
Constructor for a part with a name and content only.- See Also:
 
 - 
MockPart
Constructor for a part with a name, filename, and content.- See Also:
 
 - 
MockPart
public MockPart(String name, @Nullable String filename, @Nullable byte[] content, @Nullable MediaType contentType) Constructor for a part with a name, filename, content, and content type.- Since:
 - 6.1.2
 - See Also:
 
 
 - 
 - 
Method Details
- 
getName
 - 
getSubmittedFileName
- Specified by:
 getSubmittedFileNamein interfacePart
 - 
getContentType
- Specified by:
 getContentTypein interfacePart
 - 
getSize
public long getSize() - 
getInputStream
- Specified by:
 getInputStreamin interfacePart- Throws:
 IOException
 - 
write
- Specified by:
 writein interfacePart- Throws:
 IOException
 - 
delete
- Specified by:
 deletein interfacePart- Throws:
 IOException
 - 
getHeader
 - 
getHeaders
- Specified by:
 getHeadersin interfacePart
 - 
getHeaderNames
- Specified by:
 getHeaderNamesin interfacePart
 - 
getHeaders
Return theHttpHeadersbacking header related accessor methods, allowing for populating selected header entries. 
 -