Last active
February 21, 2020 00:08
-
-
Save markchristopherng/945ad4c7e5c3b9cbbce2a48acde0101f 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
@RunWith(MockitoJUnitRunner::class) | |
class GreetingServiceTest { | |
private lateinit var greetingService: GreetingService | |
@Mock | |
lateinit var timeService: TimeService | |
@Before | |
fun setup() { | |
greetingService = GreetingServiceImpl(MessageData("welcome to Dagger"), timeService) | |
} | |
@Test | |
fun testGreetingInTheMorning() { | |
whenever(timeService.getHourOfDay()).thenReturn(9) | |
assertEquals("Good morning, welcome to Dagger", greetingService.greetings()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment