Package rife.test
Class MockFileUpload
java.lang.Object
rife.test.MockFileUpload
An instance of this class provides all the data that is needed to simulate
a file upload.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionMockFileUpload(File file) Creates a new file upload simulation based on aFileobject.MockFileUpload(File file, String contentType) Creates a new file upload simulation based on aFileobject.MockFileUpload(String fileName, InputStream inputStream, String contentType) Creates a new file upload simulation based on anInputStream. -
Method Summary
Modifier and TypeMethodDescriptionReturns the content type associated with this file upload simulation.
-
Constructor Details
-
MockFileUpload
Creates a new file upload simulation based on aFileobject.The content type will be guessed from the file extension. The extension to mime-type mapping is retrieved from
RifeConfig.Mime.- Parameters:
file- the file that will be uploaded- Since:
- 1.0
-
MockFileUpload
Creates a new file upload simulation based on aFileobject.- Parameters:
file- the file that will be uploadedcontentType- the content type of the file- Since:
- 1.0
-
MockFileUpload
Creates a new file upload simulation based on anInputStream.- Parameters:
fileName- the name of file that will be uploadedinputStream- the input stream that will be read to provide the content of the uploaded filecontentType- the content type of the uploaded file- Since:
- 1.0
-
-
Method Details
-
getContentType
Returns the content type associated with this file upload simulation.If no content type has been provided, and it could not be detected automatically, then it defaults to
text/plain.- Returns:
- the content type
- Since:
- 1.0
-