Skip to content

Instantly share code, notes, and snippets.

@markchristopherng
Created February 19, 2020 01:00
Show Gist options
  • Save markchristopherng/ca754354761c34a1a5f8c4f361f37008 to your computer and use it in GitHub Desktop.
Save markchristopherng/ca754354761c34a1a5f8c4f361f37008 to your computer and use it in GitHub Desktop.
class GreetingServiceTest {
@Test
fun testGreetingInTheMorning() {
val testContainer = Kodein {
import(kodeinModule)
bind<TimeService>(overrides = true) with singleton {
object : TimeService {
override fun getHourOfDay(): Int = 9
}
}
}
val greetingService by testContainer.instance<GreetingService>()
assertEquals("Good morning, welcome to Kodein", greetingService.greetings())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment