【发布时间】:2015-11-16 19:54:55
【问题描述】:
我有一些属性标记为内部的类。 然后我尝试从 java 中的测试代码中设置该属性。 我怎样才能访问这些属性?测试代码和类代码在同一个包中。
示例:
class MainActivity : AppCompatActivity() {
interal var someProperty = "test"
}
测试代码:
@Test
public void firstStartTest() {
val activity = MainActivity()
activity.setSomeProperty("something") //does not compile
}
Android Studio 建议使用 activity.setSomeProperty$production_sources_for_module_app(); 但这也无法编译。
【问题讨论】:
标签: java android unit-testing kotlin