Когда использовать Mockito.verify ()?

Я пишу тестовые примеры jUnit для 3 целей:

To ensure that my code satisfies all of the required functionality, under all (or most of) the input combinations/values. To ensure that I can change the implementation, and rely on JUnit test cases to tell me that all my functionality is still satisfied. As a documentation of all the use cases my code handles, and act as a spec for refactoring - should the code ever need to be rewritten. (Refactor the code, and if my jUnit tests fail - you probably missed some use case).

Я не понимаю почему или когдаMockito.verify() должен быть использован. Когда я вижуverify() будучи вызванным, он говорит мне, что мой jUnit узнает о реализации. (Таким образом, изменение моей реализации сломало бы мои jUnits, даже при том, что моя функциональность не была затронута).

Я ищу:

What should be the guidelines for appropriate usage of Mockito.verify()?

Is it fundamentally correct for jUnits to be aware of, or tightly coupled to, the implementation of the class under test?

Ответы на вопрос(5)

Ваш ответ на вопрос