akowal
03/09/2020, 2:51 PMStringSpec
), all the mocks I need are declared as local variables inside same lambda and not re-initialized for each test case (like in vanilla JUnit). Essentially it means that the 2nd test can see mock invocations from the 1st one, messing up all verifications. How can I avoid that?LeoColman
03/09/2020, 3:00 PMafterTest
of some sort or you can set the IsolationMode of your spec class to InstancePerTest
, that way the class will be created for every testwasyl
03/09/2020, 3:12 PMInstancePerLeaf
, which as I understand will recreate the mocks only once per each test block, and not for the intermediate ones, right?LeoColman
03/09/2020, 3:13 PMakowal
03/09/2020, 3:16 PMakowal
03/09/2020, 3:17 PMInstancePerLeaf
is a better choice to prevent unanticipated calls.