Created
March 6, 2018 17:30
-
-
Save ditn/74048f746bf66221be3311cea3b81bb2 to your computer and use it in GitHub Desktop.
An example of a better 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 { | |
private val subject: ClassToTest = mock() | |
@Test | |
fun `verify this causes that`() { | |
// Arrange | |
val aValue = 10 | |
whenever(mockedClass.getValue()).thenReturn(aValue) | |
// Act | |
val result = subject.callFunctionToBeTested(mockedClass) | |
// Assert | |
verify(mockedClass).getValue() | |
verify(mockedClass).someSideEffect() | |
result `should equal` aValue | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment