mg6maciej
04/03/2016, 8:19 PMinterface SomeInterface {
String someMethod();
}
you can write a stub for it simply like this:
val stub = SomeInterface { "some string" }
When having the same interface in Kotlin:
interface SomeInterface2 {
fun someMethod(): String
}
you have to write it more verbosely:
val stub2 = object : SomeInterface2 {
override fun someMethod() = "some string"
}
What can you do to make it look better when using Kotlin in both production and test code?
val stub2 = SomeInterface2 { "some string" }