I am writing a unit test with mocks and I am concerned about over specifying the test. The idea being that if the implementation changes in a compatible way the test shouldn't fail since that makes the test fragile and inconvenient.For example, if the implementation calls mock.add(foo) followed by mock.add(bar) or it calls mock.add(foo,bar) it shouldn't matter, but from a mocking perspective you are then lead to validate all the possibilities that could have been implemented. For methods with lots of overloads for convenience (eg System.out.println) this would be exhausting!So, to be clear, my question is: how to work with mocks when they are many equivalent methods that could be called by the implementation in such a way that the resulting tests aren't fragile?PS- Not that I think it matters, but I am on Java using Mockito, but I feel there is some cross-language-applicable approach I'm missing. Our current approach is to just make fragile tests and fix them later.
How to handle mocking equivalent methods without making tests fragile?
unit testing;testing;mocking