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

Varargs stubbing produces incorrect behavior #31

Closed
GoogleCodeExporter opened this issue Nov 2, 2015 · 3 comments
Closed

Varargs stubbing produces incorrect behavior #31

GoogleCodeExporter opened this issue Nov 2, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

The following test fails .

public class VarArgsTest {

    interface MyClass {
        public String doSomething(String string, String... varargs);
    }

    @Test
    public void shouldWork() {
        MyClass myClass = mock(MyClass.class);
        when(myClass.doSomething("hello", null)).thenReturn("hello");
        when(myClass.doSomething("goodbye", null)).thenReturn("goodbye");

        String result = myClass.doSomething("hello", null);
        assertEquals("hello", result);
    }

What is the expected output? What do you see instead?
the expected output is "hello" but instead returns "goodbye"

What version of the product are you using? On what operating system?
v1.6 Windows XP 32 bit

Please provide any additional information below.


Original issue reported on code.google.com by melodiou...@gmail.com on 3 Nov 2008 at 10:53

@GoogleCodeExporter
Copy link
Author

Looking at it

Original comment by szcze...@gmail.com on 3 Nov 2008 at 11:36

@GoogleCodeExporter
Copy link
Author

The fix is in the trunk. Thanks for the bug report!

Original comment by szcze...@gmail.com on 4 Nov 2008 at 12:00

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by szcze...@gmail.com on 14 Jan 2009 at 10:48

  • Added labels: Milestone-Release1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant