Tutorial

Mockito Argument Matchers - any(), eq()

Published on August 3, 2022
author

Pankaj

Mockito Argument Matchers - any(), eq()

Mockito allows us to create mock objects and stub the behavior for our test cases. We usually mock the behavior using when() and thenReturn() on the mock object.

Mockito Argument Matchers - any()

Mockito Argument Matcher - eq()

Mockito AdditionalMatchers

Mockito Verify Argument Matchers

Mockito verify method.

verify(mockFoo, atLeast(0)).bool(anyString(), anyInt(), any(Object.class));
verify(mockFoo, atLeast(0)).bool(eq("false"), anyInt(), any(Object.class));