Skip to content

JvmField annotation makes testing very difficult #138

@hudson155

Description

@hudson155

The typical way to test interaction with external APIs is to mock them.

val stytch = mockk<StytchClient>

every { stytch.users } returns mockk {
  every { create(any()) } returns mockk()
}

However, because of the @JvmField annotations on StytchClient.users and the other fields, this becomes impossible (MockK, Mockito, etc. can only mock getters, not fields themselves).

Is there a good reason for those annotations? If not, let's remove them?

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