Question

My mock object has this method I want to verify being called:

void postResource(String url, int x, String[][] headers)

How do I use the any() methods to verify if postResource was called with any headers parameter?

http = mock(Http.class);
verify(http, never()).postResource(anyString, anyInt(), ?)

Even better, is there a way to just verify a method with any combination of arguments? Something like

verify(http, never()).postResource(anyArguments)
Was it helpful?

Solution

This should work:

Mockito.any(String[][].class)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top