Skip to content

Write automated tests: Android Basics with Compose - explains @VisibleForTesting unclear or wrong #331

@michielwittkampf

Description

@michielwittkampf

In https://developer.android.com/codelabs/basic-android-kotlin-compose-write-automated-tests#3
The meaning of the annotation @VisibleForTesting is unclear (or wrongly explained).

The actual purpose of the annotation is just to document, not to change, the visibility:
https://developer.android.com/reference/androidx/annotation/VisibleForTesting

Yet, the course states that:
"In the MainActivity.kt file on the line before the calculateTip() method, add the @VisibleForTesting annotation:
....
This makes the method public, but indicates to others that it's only public for testing purposes."

The cited course sentences can also be read differently. But then it should state "This makes the method internal, but .... only internal for ....".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions