Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any.get() extension function is colliding with other classes extension function #1243

Open
3 tasks done
Morteza-Rastgoo opened this issue Apr 25, 2024 · 0 comments
Open
3 tasks done

Comments

@Morteza-Rastgoo
Copy link

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

Should be able to use ".get()" extension function from other classes

Current Behavior

Using ".get()" extension function from other classes is impossible as a result of having it on "Any" object type

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. step 1: Find another class that has an extension function named ".get()"
  2. step 2: Use an instance of that class and try to use ".get()" function on that object.
  3. you'll get: The ".get" function from mockk is being used and there's no way to switch to the intended one from other classes.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • MockK version: 1.13.9
  • OS: Android
  • Kotlin version: 1.9.23
  • JDK version: openjdk 17.0.7 2023-04-18
  • JUnit version:
  • Type of test: unit test OR android instrumented test

Failure Logs

Please include any relevant log snippets or files here.


#### Minimal reproducible code (the gist of this issue)

```kotlin
// -----------------------[ YOUR CODE STARTS HERE ] -----------------------
        coEvery { httpService.get<AddressDto>(any<CloudRequest<String>>()) } returns success(
            AddressDto(
                streetName = "London Road",
                streetNumber = "54",
                city = "London",
                district = "GB",
                fullAddress = "Olearys Bar, 270 London Rd, Stoke-on-Trent ST4 5AB, UK"
            )
        )
// -----------------------[ YOUR CODE ENDS HERE ] -----------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant