Package com.vaadin.flow.component.upload
Class UploadTester
-
- All Implemented Interfaces:
public class UploadTester<T extends Upload> extends ComponentTester<T>
Tester for Upload components.
-
-
Constructor Summary
Constructors Constructor Description UploadTester(T component)Wrap given component for testing.
-
Method Summary
Modifier and Type Method Description voidupload(String fileName, String contentType, InputStream contents)Send the file data to the Upload component as if it is uploaded in the browser. voidupload(String fileName, String contentType, Array<byte> contents)Send the file data to the Upload component as if it is uploaded in the browser. voidupload(File file)Send the file data to the Upload component as if it is uploaded in the browser. voiduploadAll(Array<File> files)Simulates uploading multiple files at once. voiduploadAll(Collection<File> files)Simulates uploading multiple files at once. voiduploadAborted(String fileName, String contentType)Simulates upload interruption by user on browser. voiduploadAborted(File file)Simulates upload interruption by user on browser. voiduploadFailed(File file)Simulates a failure during file upload. voiduploadFailed(String fileName, String contentType)Simulates a failure during file upload. -
-
Constructor Detail
-
UploadTester
UploadTester(T component)
Wrap given component for testing.- Parameters:
component- target component
-
-
Method Detail
-
upload
void upload(String fileName, String contentType, InputStream contents)
Send the file data to the Upload component as if it is uploaded in the browser.
- Parameters:
fileName- name of the file to uploadcontentType- content type of the file to uploadcontents- file contents as an array of bytes
-
upload
void upload(String fileName, String contentType, Array<byte> contents)
Send the file data to the Upload component as if it is uploaded in the browser.
- Parameters:
fileName- name of the file to uploadcontentType- content type of the file to uploadcontents- file contents as an array of bytes
-
upload
void upload(File file)
Send the file data to the Upload component as if it is uploaded in the browser. The content type is detected from file name.
- Parameters:
file- the file to upload
-
uploadAll
void uploadAll(Array<File> files)
Simulates uploading multiple files at once.
- Parameters:
files- files to upload
-
uploadAll
void uploadAll(Collection<File> files)
Simulates uploading multiple files at once.
- Parameters:
files- files to upload
-
uploadAborted
void uploadAborted(String fileName, String contentType)
Simulates upload interruption by user on browser.
- Parameters:
fileName- name of uploading filecontentType- content type of the uploading file
-
uploadAborted
void uploadAborted(File file)
Simulates upload interruption by user on browser.
- Parameters:
file- uploading file
-
uploadFailed
void uploadFailed(File file)
Simulates a failure during file upload.
- Parameters:
file- uploading file
-
uploadFailed
void uploadFailed(String fileName, String contentType)
Simulates a failure during file upload.
- Parameters:
fileName- name of uploading filecontentType- content type of the uploading file
-
-
-
-