How to test for I/O failure?
I have a try catch block in UI component’s controller class. The catch block catches IOException thrown by FXMLLoader’s static ‘load()’ method, I think.
The exception is caught, logged using logger + shown to user in the form of a custom alert.
I’ve tried using mockito and mocking fxml loader’s static load() method alongside TestFx for Junit5… but nothing seems to work.
How does one test for IOException thrown as a result of user interaction?
6 Replies
⌛
This post has been reserved for your question.
Hey @moa! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
You could pass the name of the FXML file as an argument or similar
and then use the name of a nonexisting file
or you say "that shouldn't happen, I am not testing it"
@dan1st | Daniel by Mocking the controller’s method or FXMLLoder?
that might be possible as well
but I meant changing adding a parameter to the method
This method is an onAction event handler method though
💤
Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping
.
Warning: abusing this will result in moderative actions taken against you.