Hanbit the Developer
Why is @get:Rule used instead of @Rule in Kotlin? 본문
Using test rules can help you write more efficient and effective tests, and can save you time by automating common testing tasks. And @Rule annotation is used to declare the test rule in JUnit. But in sunflower created by Google Android, @get:Rule
is used instead of @Rule
.
In Kotlin, properties are compiled to getter and setter in Java, rather than public fields. So we need to apply the @Rule
annotation to the getter method. And the @get:Rule
annotation in Kotlin apply the @Rule
annotation to the getter method.
'Android' 카테고리의 다른 글
[Kotlin] Coroutines 예외 처리 방법 비교 (0) | 2023.08.28 |
---|---|
[Android] Cleaning gradle using KTS(Kotlin DSL), Version Catalogs(toml) (0) | 2023.03.08 |
Android Library FiveStarsView has been released. (0) | 2023.02.13 |
android/nowinandroid 구조 파헤치기 (0) | 2022.11.30 |
[Android] Touch event to move & pinch zoom (0) | 2022.11.30 |