converting java to kotlin, it has a java package level visibility class
class NotificationManager extends Base {
NotificationManager(Context context) {
super(context);
... ...
}
the unit test to assert this constructor is not public
@Test
public void verify_Constructor() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
Constructor<NotificationManager> constructor = NotificationManager.class.getDeclaredConstructor(Context.class);
constructor.newInstance(application);
assertFalse(Modifier.isPublic(constructor.getModifiers()));
}
after convert kotlin, it is turned into internal visibility
internal class NotificationManager internal constructor(context: Context) : Base(context) {...}
but the test failed at assertFalse(Modifier.isPublic(constructor.getModifiers()));.
In unit test how to assert a kotlin internal class constructor is not public?