/** * Calls the file generator provided and with the resulting file or opens it on the developers desktop or * immediately deletes the generated file (depending on {@link #setOpenGeneratedFiles(boolean)}. * * @see SingularTestUtil#showFileOnDesktopForUser(File) */ protected <EX extends Exception> void generateFileAndShowOnDesktopForUser( @Nonnull IFunctionEx<TempFileProvider, File, EX> fileGenerator) { File file; try { file = fileGenerator.apply(getTempFileProvider()); } catch (Exception e) { Throwables.throwIfUnchecked(e); throw SingularException.rethrow(e); } if (file != null) { if (isOpenGeneratedFiles()) { SingularTestUtil.showFileOnDesktopForUser(file); } else { TempFileUtils.deleteOrException(file, this); } } }