TestFX / Monocle

Pre-packaged builds of Monocle (OpenJFX)
GNU General Public License v2.0
50 stars 24 forks source link

Easy way to Turn of Not Supported Exception #53

Closed nartz closed 9 months ago

nartz commented 6 years ago

Our application tests in UI mode click some buttons that open file chooser. In headless mode, our tests use monocle, and showing file choosers are not supported by monocle, of which is unsupported by monocle i.e. java.lang.UnsupportedOperationException ( at com.sun.glass.ui.monocle.MonocleApplication.staticCommonDialogs_showFileChooser(MonocleApplication.java:293))

We want to just suppress just this error message in headless mode. Is there an easy and simple way to do this? We would like not to have to change our application code (i.e. catch this error specifically) in all places that we try to open dialogs. One thought is to override this method to just not return an exception in headless mode? Not sure how to do this properly - or maybe a mocking library out there would allow to stub the filechooser method somehow?

Thanks.

Lonzak commented 3 years ago

@narz Did you try the solution? https://stackoverflow.com/questions/29116819/javafx-maven-testfx-monocle-dont-work-together

@Maintainer I want to run an JavaFX application on a raspberry PI however I get this exact exception. Is there a way to fix this? Can you implement this? Or should I try to use a different FileChooser?

mvsoder commented 9 months ago

This repository is simply a copy of the official Monocle code found in the JFX repository: https://github.com/openjdk/jfx. We only maintain this repository for purposes of building the library to support headless testing with TestFX. Our apologies.