i remember reading example shows how set member of mocked object, ex:
myclass mockedclass = mock(myclass.class); //and set `somevariable` value mokito.set(mockedclass.somevariable, actual_value_intended_to_be_set);
unfortunately not able find link again. can give reverence such examples or explain here ?
if want mock's outward behavior mockedclass.somevariable has actual_value_intended_to_be_set, can write:
when(mockedclass.getsomevariable()).thenreturn(actual_value_intended_to_be_set);
happy mocking!
Comments
Post a Comment