Jiri Bruchanov
02/04/2020, 10:17 AMJiri Bruchanov
02/04/2020, 10:19 AM@RunWith(AndroidJUnit4::class)
class XYZKt {
@Rule
val emojiTestRule = EmojiTestRule()
@Test
fun testZ() {
println("X")
}
}
after decompiling it's
public final class XYZKt {
@Rule
@NotNull
private final EmojiTestRule emojiTestRule = new EmojiTestRule();
...
}
And JUnit is failing, because that Rule field is private,
is there a way how to force it to make it public ?Jiri Bruchanov
02/04/2020, 10:20 AMmirror-kt
02/04/2020, 10:21 AM@get:Rule
val emojiTestRule = EmojiTestRule()
will not work fine?mirror-kt
02/04/2020, 10:23 AMpublic final class XYZKt {
@NotNull
private final EmojiTestRule emojiTestRule = new EmojiTestRule();
...
@Rule
public EmojiTestRule getEmojiTestRule() {
return emojiTestRule;
}
}
diesieben07
02/04/2020, 10:24 AMvar
). Only getter and setter will have the visibility you specify.
You can annotate your property with @JvmField
to disable generation of getters/setters and only use a plain field.Jiri Bruchanov
02/04/2020, 10:35 AM