https://kotlinlang.org logo
#kodein
Title
r

rsredsq

08/21/2017, 7:46 PM
Hello, everyone! I'm using Kodein for my project, but I have a small problem with junit integration. I start my application in @Before function annotation like:
Copy code
@Before
  fun init(ctx: TestContext) {
    val app = MyApplication()
    app.start()
  }
In constructor I'm configuring Kodein(using a global kodein instance, I don't know, maybe it's not the best way):
Copy code
Kodein.global.addImport(Kodein.Module {
    bind<Repository>() with singleton { Repository() }
  })
And then I've stucked at problem, if I run two tests concurrently(I assume that jvm is not created twice), Kodein global variable will stay the same, And I'll get and exception. How this can be solved? Thanks!