8000 MockK 1.13.16 wraps `Results` objects twice · Issue #1333 · mockk/mockk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MockK 1.13.16 wraps Results objects twice #1333

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

8000 Closed
sschuberth opened this issue Jan 11, 2025 · 5 comments
Closed

MockK 1.13.16 wraps Results objects twice #1333

sschuberth opened this issue Jan 11, 2025 · 5 comments

Comments

@sschuberth
Copy link

After upgrading from MockK 1.13.14 to 1.13.16, one of our tests starts to fail with

Result should be Success(fake_file), but was Success(Success(fake_file))
java.lang.AssertionError: Result should be Success(fake_file), but was Success(Success(fake_file))

The code for the test (using Kotest) looks like this:

    "return the generated file(s)" {
        val (_, reporterMock) = createReporterMock()
        val input = createReporterInput(SCANCODE_1)

        val reportFileResults = reporterMock.generateReport(input)

        reportFileResults.shouldBeSingleton {
            it shouldBeSuccess FILE_SAMPLE
        }
    }

So it's Kotest's shouldBeSuccess assertion that fails now.

Can this "double wrapping" in a Result type be a negative side-effect of #1332, @kpadhiamex?

@JWvanV
Copy link
JWvanV commented Jan 11, 2025

We encountered the same issue.
After updating from .14 to .16, many unit tests started failing because of the extra wrapped result as mentioned in the Original Post.

@corentin-c
Copy link

Same issue here migrating from .12 to .16 broke many of our tests

@egalyautdinova
Copy link

After upgrading from MockK 1.13.14 to 1.13.16 our test with the following statement started to fail with ClassCastException
coEvery { myClass.myMethod() } returns Result.failure(ResourceNotFoundException("Error message"))

@Alexs784
Copy link

Same issue here after updating from .14 to .16

@JWvanV
Copy link
JWvanV commented Mar 2, 2025

We no longer have the issues after version 1.13.17 was released!

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

5 participants
0