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
ConstructorDescriptionConstructor 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 TypeMethodDescriptionvoid
delete()
final HttpHeaders
Return theHttpHeaders
backing header related accessor methods, allowing for populating selected header entries.getHeaders
(String name) getName()
long
getSize()
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:
getSubmittedFileName
in interfacePart
-
getContentType
- Specified by:
getContentType
in interfacePart
-
getSize
public long getSize() -
getInputStream
- Specified by:
getInputStream
in interfacePart
- Throws:
IOException
-
write
- Specified by:
write
in interfacePart
- Throws:
IOException
-
delete
- Specified by:
delete
in interfacePart
- Throws:
IOException
-
getHeader
-
getHeaders
- Specified by:
getHeaders
in interfacePart
-
getHeaderNames
- Specified by:
getHeaderNames
in interfacePart
-
getHeaders
Return theHttpHeaders
backing header related accessor methods, allowing for populating selected header entries.
-