On Tue, 27 Oct 2020 10:23:39 GMT, Jeanette Winzenburg <faste...@openjdk.org> 
wrote:

>> Hmm.. very good point. I believe, we should use dispose mechanism whenever 
>> available for a readable cleanup. Both classes MouseEventFirer & StageLoader 
>> provide dispose method and the user of these classes should use it.
>> Now, this can be handled in two ways -
>> 1) Keep a reference at test class level - it will be null by default - 
>> individual tests will create the object and update the class reference - we 
>> can dispose in cleanup method after the test
>> 2) Use Try blocks in tests that use MouseEventFirerer or StageLoader objects 
>> and dispose them in finally{} blocks.
>> 
>> We can use (1) if many tests in a test class use MouseEventFirerer or 
>> StageLoader objects - for example ComboBoxTest and use approach (2) if very 
>> few tests use these classes - for example ButtonTest.
>
> makes sense :)

just looked at MouseEventFirer (a bit late, sry ;): all it does is to dispose 
the Stageloader it created (if it received a bare node) - so if we add a node 
to a stage and/or wrap it into our own loader, we don't really need to dispose 
the firer (though it doesn't hurt except a very minimal code clutter)

-------------

PR: https://git.openjdk.java.net/jfx/pull/337

Reply via email to