Created
February 19, 2020 00:23
-
-
Save markchristopherng/d5a6b9adc187c1b4f4f6d2355863f561 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 GreetingServiceMockTest : KoinTest { | |
private val greetingService: GreetingService by inject() | |
@Test | |
fun testGreetingInTheMorning() { | |
startKoin { modules(koinModule) } | |
declareMock<TimeService> { | |
given(this.getHourOfDay()).willReturn(9) | |
} | |
assertEquals("Good morning, welcome to Koin", greetingService.greetings()) | |
stopKoin() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment