Skip to content

Conversation

ath0s
Copy link
Contributor

@ath0s ath0s commented Jan 18, 2024

The Problem

When using capture with a mutable list of a value type (i.e. using CaptureMatcher), the wrapped value is captured rather than the value type:

expected: <DummyValue(value=101)> but was: <101>

When using capture with a slot (i.e. using CapturingSlotMatcher) this is handled by calling the internal boxCast helper function.

The Solution

Use boxCast in CaptureMatcher , in the same way as CapturingSlotMatcher does.

Use `boxCast`, in the same way as `CapturingSlotMatcher` does.
@Raibaz
Copy link
Collaborator

Raibaz commented Jan 19, 2024

Nice one, thanks for catching this and taking the time to look into it!

@Raibaz Raibaz merged commit 108f9b4 into mockk:master Jan 19, 2024
@ath0s ath0s deleted the capture-mutable-list-value-class branch January 19, 2024 20:17
sksamuel referenced this pull request in kotest/kotest Mar 9, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [io.mockk:mockk](https://mockk.io)
([source](https://togithub.com/mockk/mockk)) | `1.13.9` -> `1.13.10` |
[![age](https://developer.mend.io/api/mc/badges/age/maven/io.mockk:mockk/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/io.mockk:mockk/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/io.mockk:mockk/1.13.9/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/io.mockk:mockk/1.13.9/1.13.10?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mockk/mockk (io.mockk:mockk)</summary>

### [`v1.13.10`](https://togithub.com/mockk/mockk/releases/tag/1.13.10)

[Compare
Source](https://togithub.com/mockk/mockk/compare/1.13.9...1.13.10)

#### What's Changed

- Add support to nested value classes by
[@&#8203;rotilho](https://togithub.com/rotilho) in
[https://github.com/mockk/mockk/pull/1202](https://togithub.com/mockk/mockk/pull/1202)
- Fix callOriginal on default interface method by
[@&#8203;flapenna](https://togithub.com/flapenna) in
[https://github.com/mockk/mockk/pull/1203](https://togithub.com/mockk/mockk/pull/1203)
- Only unbox value class answers when appropriate by
[@&#8203;jselbo](https://togithub.com/jselbo) in
[https://github.com/mockk/mockk/pull/1204](https://togithub.com/mockk/mockk/pull/1204)
- Fix capture using mutable list of value class by
[@&#8203;ath0s](https://togithub.com/ath0s) in
[https://github.com/mockk/mockk/pull/1209](https://togithub.com/mockk/mockk/pull/1209)
- Updates documentation to include example access error workaround for
Android users by [@&#8203;JakeSteam](https://togithub.com/JakeSteam) in
[https://github.com/mockk/mockk/pull/1211](https://togithub.com/mockk/mockk/pull/1211)

#### New Contributors

- [@&#8203;rotilho](https://togithub.com/rotilho) made their first
contribution in
[https://github.com/mockk/mockk/pull/1202](https://togithub.com/mockk/mockk/pull/1202)
- [@&#8203;jselbo](https://togithub.com/jselbo) made their first
contribution in
[https://github.com/mockk/mockk/pull/1204](https://togithub.com/mockk/mockk/pull/1204)
- [@&#8203;ath0s](https://togithub.com/ath0s) made their first
contribution in
[https://github.com/mockk/mockk/pull/1209](https://togithub.com/mockk/mockk/pull/1209)
- [@&#8203;JakeSteam](https://togithub.com/JakeSteam) made their first
contribution in
[https://github.com/mockk/mockk/pull/1211](https://togithub.com/mockk/mockk/pull/1211)

**Full Changelog**:
mockk/mockk@1.13.9...1.13.10

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 3am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/kotest/kotest).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMjAuMiIsInVwZGF0ZWRJblZlciI6IjM3LjIyNy4yIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants