From 26c216cb7a87a0e605e68c2187df95522eca9eb9 Mon Sep 17 00:00:00 2001 From: mipo256 Date: Fri, 14 Feb 2025 14:15:15 +0300 Subject: [PATCH] Clarified strict mocks doc --- docs/interaction_based_testing.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/interaction_based_testing.adoc b/docs/interaction_based_testing.adoc index 89dc056dbc..88850578eb 100644 --- a/docs/interaction_based_testing.adoc +++ b/docs/interaction_based_testing.adoc @@ -75,10 +75,10 @@ code that expects this type. .Lenient vs. Strict Mocking Frameworks **** -Like Mockito, we firmly believe that a mocking framework should be lenient by default. This means that unexpected +We firmly believe that a mocking framework should be lenient by default. This means that unexpected method calls on mock objects (or, in other words, interactions that aren't relevant for the test at hand) are allowed -and answered with a default response. Conversely, mocking frameworks like EasyMock and JMock are strict by default, -and throw an exception for every unexpected method call. While strictness enforces rigor, it can also lead +and answered with a default response. Conversely, other mocking frameworks like EasyMock, JMock and Mockito (starting with Mockito v4) +are strict by default, and throw an exception for every unexpected method call. While strictness enforces rigor, it can also lead to over-specification, resulting in brittle tests that fail with every other internal code change. Spock's mocking framework makes it easy to describe only what's relevant about an interaction, avoiding the over-specification trap. ****