Logo Questions Linux Laravel Mysql Ubuntu Git Menu

What access modifier for testable helper methods?

In Java, helper methods are often marked protected instead of private, so that unit tests within the same package can test the helper methods. (Specifically, I am using JUnit.)

This does not seem to work in Kotlin. What access modifier is recommended instead?

like image 957
fredoverflow Avatar asked Mar 17 '23 12:03


1 Answers

internal (or no modifier) works well here

like image 81
Andrey Breslav Avatar answered Mar 25 '23 13:03

Andrey Breslav