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

Php operator `break` doesn't stop while -

ubuntu - Bash Script to Check That Files Are Being Created -

vim: Search & replace -