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

ArgumentCaptor with varArgs-arrays returning unexpected behavior when using getAllValues #1652

Open
TungDoanDuong opened this issue Mar 5, 2019 · 1 comment

Comments

@TungDoanDuong
Copy link

TungDoanDuong commented Mar 5, 2019

Hi,

There's an issue with ArgumentCaptor when using the method 'getAllValues()' while using varargs

Here is an example:

    someMethod(String... words)

    ArgumentCaptor<String[]> varargsCaptor = ArgumentCaptor.forClass(String[].class);

    mock.someMethod("1", "2");
    mock.someMethod("3", "4", "5");

    List<String[]> messageList = new ArrayList<>();

    messageList.addAll(varargsCaptor .getAllValues());

    assertEquals(2, messageList.size());

java.lang.AssertionError:
Expected :2
Actual :5

I am expecting: [ ["1", "2"], ["2", "3", "4"] ]
However I am getting: ["1", "2", "3", "4", "5"]

@TungDoanDuong
Copy link
Author

Relates to #1222

This #1224 seems to fix it

Is there any plan to merge the fixes in a near future?

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