Last active
September 29, 2017 22:18
-
-
Save fbcbl/2ab8ad9e35f712b2caeb55d0f8887d76 to your computer and use it in GitHub Desktop.
Kotlin Testing Part 1 Test
This file contains 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
import org.junit.Before | |
import org.junit.Test | |
import org.junit.Assert.* | |
import org.mockito.Mock | |
import org.mockito.Mockito | |
import org.mockito.MockitoAnnotations | |
class GreeterTest { | |
@Mock | |
lateinit var user: User | |
lateinit var tested: Greeter | |
@Before | |
fun setUp() { | |
MockitoAnnotations.initMocks(this) | |
tested = Greeter(user) | |
} | |
@Test | |
fun englishGreetIsCorrect() { | |
Mockito.`when`(user.fullName()).thenReturn("Fábio Carballo") | |
assertEquals("Hello, Fábio Carballo!", tested.getEnglishGreeting()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment