therefore i'm need create scope and inject my mock...
# tornadofx
r
therefore i'm need create scope and inject my mock ? how can i override scope of my controller instance ?
Copy code
class HomeControllerTest {
    companion object {
        lateinit var homeController: HomeController

        @BeforeAll
        @JvmStatic
        fun main() {
            val latch = CountDownLatch(1)
            SwingUtilities.invokeLater {
                JFXPanel()
                latch.countDown()
            }

            if (!latch.await(5L, TimeUnit.SECONDS)) {
                throw ExceptionInInitializerError()
            }

            homeController = HomeController()
        }
    }

    @Test
    fun `loadErpPrinters with exception`() {
        val mock = mock<Rest>() {
            on { loadErpPrinters() } doThrow KPrinterApiException()
        }
        
    }