Mockito matcher and array of primitives

后端 未结 8 1185
既然无缘
既然无缘 2021-01-30 05:53

With Mockito, I want to verify() a method call with byte[] in its argument list, but I didn\'t find how to write this.

 myMethod( byte[         


        
相关标签:
8条回答
  • 2021-01-30 06:39

    You can use Mockito.any() when arguments are arrays also. I used it like this:

    verify(myMock, times(0)).setContents(any(), any());
    
    0 讨论(0)
  • 2021-01-30 06:40

    I would rather use Matchers.<byte[]>any(). This worked for me.

    0 讨论(0)
提交回复
热议问题