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

Attempting to verify mocked calls with a class that has a string array parameter in its constructor throws UnsupportedOperationException #75

Closed
xiphirx opened this issue Sep 23, 2016 · 0 comments
Assignees

Comments

@xiphirx
Copy link

xiphirx commented Sep 23, 2016

Hi,

I'm running into an issue where I'm trying to verify mocked calls on an object with the use of eq.

My test looks like:

data class Foo(val baz: Array<String>)

val bar = Foo(arrayOf("a", "b"))

@Test fun test() {
    verify(mock).method(eq(bar))
}

This fails with

java.lang.UnsupportedOperationException: Cannot create a generic array for Array. Use createArrayInstance() or anyArray() instead.
    at com.nhaarman.mockito_kotlin.CreateInstanceKt.toArrayInstance(CreateInstance.kt:124)
    at com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:61)
    at com.nhaarman.mockito_kotlin.CreateInstanceKt.createNullableInstance(CreateInstance.kt:162)
    at com.nhaarman.mockito_kotlin.CreateInstanceKt.newInstance(CreateInstance.kt:137)
    at com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:63)

Is there something that can be done about this?

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

2 participants