Hi, I read in tornadofx guide that Views, Controllers and Models are Singeltones, If I would like to mock a controller or a model for testing, how I can do that?
r
Ruckus
04/22/2019, 2:00 PM
You can look into `Scope`s and see if that will do it for you, but I tend to prefer the tried and true method of creating an interface that the controller implements, then you can just mock the interface.
👍 1
Ruckus
04/22/2019, 2:01 PM
I'm not saying it's a better (or even good) solution, just that it's what I've done for years and never really bothered to try anything new 🙂
a
alilosoft
04/22/2019, 7:46 PM
Thanks, I will try both, and see witch one will work well for me!🤔
alilosoft
04/22/2019, 10:17 PM
If I go for the controller interface way, how I can inject the mocked controller to the view?