Mockito.verify(foo, Mockito.times(1)).add("1");
Mockito.verify(foo, Mockito.times(1)).add(Mockito.anyString());
The first verify checks the expected parametrized call and the second verify checks that there was only one call to add at all.
Mockito.verify(foo, Mockito.times(1)).add("1");
Mockito.verify(foo, Mockito.times(1)).add(Mockito.anyString());
The first verify checks the expected parametrized call and the second verify checks that there was only one call to add at all.