There is the following code. It checks the number of calls to the oneFunc function.
one = spy(one); one.oneFunc(" "); verify(one, times(1)).oneFunc(anyString()); one.oneFunc(" "); verify(one, times(2)).oneFunc(anyString()); Is it possible to somehow reset the number of calls so that calls are counted from the last zeroing? Those. something like this:
one = spy(one); one.oneFunc(" "); verify(one, times(1)).oneFunc(anyString()); //Строка, обнуляющая количество one.oneFunc(" "); verify(one, times(1)).oneFunc(anyString());
spydue to the structure of the test. I just need to reset the counter. - Andrey KuruljovMockito.reset(one);- this is what I needed. - Andrei Kurulyov