java - how can I verify a mock was called with a param with specific fields' values? -



java - how can I verify a mock was called with a param with specific fields' values? -

i write ut using mockito mock.

i want verify mock called param: myobject obj obj = { name =... , value = 9}

i want verify mock called param has value 9.

how this?

i don't want override equals(..) in myobject

mockito has argumentmatcher interface:

class islistoftwoelements extends argumentmatcher<list> { public boolean matches(object list) { homecoming ((list) list).size() == 2; } } list mock = mock(list.class); when(mock.addall(argthat(new islistoftwoelements()))).thenreturn(true);

java unit-testing mocking mockito

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -