romster
03/22/2018, 8:17 AMCzar
03/22/2018, 9:50 AMromster
03/22/2018, 10:17 AMCzar
03/22/2018, 10:18 AMromster
03/22/2018, 10:19 AMCzar
03/22/2018, 10:34 AMFleshgrinder
03/22/2018, 10:35 AMromster
03/22/2018, 10:36 AMCzar
03/22/2018, 10:41 AMFleshgrinder
03/22/2018, 10:42 AMromster
03/22/2018, 11:07 AMCzar
03/22/2018, 2:53 PMdo not test private method, or make them publicIt's more like "Test all public methods, so that private ones don't need to be tested. If by testing the public method you cannot ensure correctness, and absolutely need to test private methods, then most probably there's something dangerously wrong in the design." I understand that
internal
stuff is not truly private and should be tested, that just means: keep your tests in the same module as your code./src/main/kotlin/com/example/InternalClass.kt
/src/test/kotlin/com/example/InternalClassTest.kt
Fleshgrinder
03/22/2018, 5:29 PMinternal
is different and you can easily test them. As I said, it's more cumbersome to set up compared to a proper package visibility and I would love to see it in Kotlin but right now that's what we have:
/lib/src/main/kotlin/com/example/PublicClass.kt
/lib/src/main/kotlin/com/example/InternalClass.kt
/lib/src/test/kotlin/com/example/PublicClassTest.kt
/lib/src/test/kotlin/com/example/InternalClassTest.kt
/app/src/main/kotlin/com/example/NoAccessToInternalClass.kt