java.lang.UnsupportedOperationException: Cannot create a generic array for Array. Use createArrayInstance() or anyArray() instead.

GitHub | xiphirx | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

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

    GitHub | 7 months ago | xiphirx
    java.lang.UnsupportedOperationException: Cannot create a generic array for Array. Use createArrayInstance() or anyArray() instead.

    Root Cause Analysis

    1. java.lang.UnsupportedOperationException

      Cannot create a generic array for Array. Use createArrayInstance() or anyArray() instead.

      at com.nhaarman.mockito_kotlin.CreateInstanceKt.toArrayInstance()
    2. com.nhaarman.mockito_kotlin
      CreateInstanceKt.createInstance
      1. com.nhaarman.mockito_kotlin.CreateInstanceKt.toArrayInstance(CreateInstance.kt:124)
      2. com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:61)
      3. com.nhaarman.mockito_kotlin.CreateInstanceKt.createNullableInstance(CreateInstance.kt:162)
      4. com.nhaarman.mockito_kotlin.CreateInstanceKt.newInstance(CreateInstance.kt:137)
      5. com.nhaarman.mockito_kotlin.CreateInstanceKt.createInstance(CreateInstance.kt:63)
      5 frames