Last active
February 19, 2020 03:22
-
-
Save markchristopherng/532630b0bcb693eed97ba9569289c7c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GreetingServiceFakeTest { | |
@Inject | |
lateinit var greetingService: GreetingService | |
@Test | |
fun testGreetingInTheMorning() { | |
val testModule = module { | |
bind<TimeService>().toInstance(object : TimeService { | |
override fun getHourOfDay(): Int = 9 | |
}) | |
} | |
KTP.openRootScope().installTestModules(toothpickModule, testModule).inject(this) | |
assertEquals("Good morning, welcome to Toothpick", greetingService.greetings()) | |
Toothpick.reset() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment