If I am using a Wrapper class type variable as argument Mockito test case is getting pass but, how to write Mockito test case for int primitive type variable which is an argumen
I know that the question has been more than 4 years and 8 months old but for the sake of clear solution as of today, I am posting this
In my case, the method signature to be tested is
public SomeObject create(String code, int status)
so the test code for verifying the argument values when the method was invoked would be following
verify(this.service).create(
argThat(code -> "dummy_code".equals(code)),
intThat(status -> status == 105));
If I go with the argThat even for int (or any primitive types) then mockito throws NPE
Currently I am using org.mockito:mockito-core:jar:2.15.0 which must have been advanced considering the time when the question was asked! But thinking that this might be helpful to people... Thanks,