Last active
March 20, 2018 15:29
-
-
Save ditn/fba4164fee56c179b31676ace26538b4 to your computer and use it in GitHub Desktop.
An example of a poorly converted Kotlin class
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
class ExampleTest { | |
@Mock private var subject: ClassToTest? | |
@Before | |
fun setUp() { | |
MockitoAnnotations.initMocks(this) | |
} | |
@Test | |
fun verifyThisCausesThat() { | |
// Arrange | |
val aValue = 10 | |
`when`(mockedClass.getValue()).thenReturn(aValue) | |
// Act | |
val result = subject!!.callFunctionToBeTested(mockedClass) | |
// Assert | |
verify(mockedClass).getValue() | |
verify(mockedClass).someSideEffect() | |
assertEquals(aValue, result) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment