Skip to content

Instantly share code, notes, and snippets.

@EricDw
Created May 4, 2018 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricDw/c4778a1c21b5ec31d9a925f24cabe5a7 to your computer and use it in GitHub Desktop.
Save EricDw/c4778a1c21b5ec31d9a925f24cabe5a7 to your computer and use it in GitHub Desktop.
Utility functions to aid in cratfting kotlin JUnit tests.
import org.junit.Assert.assertTrue
fun assertTrueWithMessage(input: Any, expectedOutput: Any, actualOutput: Any) {
assertTrue(
createMessage(input, expectedOutput, actualOutput),
actualOutput == expectedOutput)
}
fun createMessage(input: Any, expectedOutput: Any, actualOutput: Any): String {
return "input was\n $input\n " +
"expected output was\n $expectedOutput\n " +
"actual output was\n $actualOutput"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment