Created
February 19, 2020 03:21
-
-
Save markchristopherng/ddce4d10cd875d979efbf35ce073f475 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 GreetingServiceMockTest { | |
@get:Rule | |
var toothPickRule = ToothPickRule(this, "scope") | |
@Inject | |
lateinit var greetingService: GreetingService | |
@Mock | |
lateinit var timeService: TimeService | |
@Before | |
fun setup() = toothPickRule.scope.installModules(toothpickModule).inject(this) | |
@Test | |
fun testGreetingInTheMorning() { | |
whenever(timeService.getHourOfDay()).thenReturn(9) | |
assertEquals("Good morning, welcome to Toothpick", greetingService.greetings()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment