public void shouldThrowErrorIfFilesToSelectIsEmpty() {
   try {
     driver.selectFiles(fileChooser, new File[0]);
     failWhenExpectingException();
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage()).isEqualTo("The array of files to select should not be empty");
   }
 }
 public void shouldThrowErrorIfJFileChooserCanOnlySelectFilesAndFileToSelectIsFolder() {
   File temporaryFolder = newTemporaryFolder();
   setFileChooserToSelectFilesOny();
   try {
     driver.selectFile(fileChooser, temporaryFolder);
     failWhenExpectingException();
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage()).contains("the file chooser cannot open directories");
   } finally {
     temporaryFolder.delete();
   }
 }
 public void shouldThrowErrorIfJFileChooserCanOnlySelectFoldersAndOneOfFilesToSelectIsFile() {
   enableMultipleSelection();
   File temporaryFolder = newTemporaryFolder();
   File temporaryFile = newTemporaryFile();
   setFileChooserToSelectDirectoriesOnly();
   try {
     driver.selectFiles(fileChooser, array(temporaryFolder, temporaryFile));
     failWhenExpectingException();
   } catch (IllegalArgumentException e) {
     assertThat(e.getMessage()).contains("the file chooser can only open directories");
   } finally {
     temporaryFile.delete();
     temporaryFile.delete();
   }
 }