Package com.vaadin.flow.component.upload
Class UploadTester<T extends Upload>
java.lang.Object
com.vaadin.testbench.unit.ComponentTester<T>
com.vaadin.flow.component.upload.UploadTester<T>
- Type Parameters:
T
- the component type.
Tester for Upload components.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Send the file data to the Upload component as if it is uploaded in the browser.void
Send the file data to the Upload component as if it is uploaded in the browser.void
upload
(String fileName, String contentType, InputStream contents) Send the file data to the Upload component as if it is uploaded in the browser.void
uploadAborted
(File file) Simulates upload interruption by user on browser.void
uploadAborted
(String fileName, String contentType) Simulates upload interruption by user on browser.void
Simulates uploading multiple files at once.void
uploadAll
(Collection<File> files) Simulates uploading multiple files at once.void
uploadFailed
(File file) Simulates a failure during file upload.void
uploadFailed
(String fileName, String contentType) Simulates a failure during file upload.Methods inherited from class com.vaadin.testbench.unit.ComponentTester
ensureComponentIsUsable, ensureComponentIsUsable, ensureVisible, ensureVisible, find, findAllByQuery, findByQuery, fireDomEvent, fireDomEvent, fireDomEvent, getComponent, getField, getField, getMethod, getMethod, isUsable, isUsable, notUsableReasons, notUsableReasons, roundTrip, setModal
-
Constructor Details
-
UploadTester
Wrap given component for testing.- Parameters:
component
- target component
-
-
Method Details
-
upload
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- Throws:
UncheckedIOException
- if the upload component fails to handle file contents
-
upload
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- Throws:
UncheckedIOException
- if the upload component fails to handle file contents
-
upload
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- Throws:
UncheckedIOException
- if the upload component fails to handle file contents
-
uploadAll
Simulates uploading multiple files at once.- Parameters:
files
- files to upload
-
uploadAll
Simulates uploading multiple files at once.- Parameters:
files
- files to upload
-
uploadAborted
Simulates upload interruption by user on browser.- Parameters:
fileName
- name of uploading filecontentType
- content type of the uploading file
-
uploadAborted
Simulates upload interruption by user on browser.- Parameters:
file
- uploading file
-
uploadFailed
Simulates a failure during file upload.- Parameters:
file
- uploading file
-
uploadFailed
Simulates a failure during file upload.- Parameters:
fileName
- name of uploading filecontentType
- content type of the uploading file
-