From 14b9ff9a2243981ef23ea1312e871e3c4b560842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Tue, 2 Jun 2026 18:25:55 +0200 Subject: [PATCH] Extend the top interaction scope to cleanup methods --- docs/interaction_based_testing.adoc | 2 +- docs/release_notes.adoc | 6 ++ .../spockframework/compiler/AstNodeCache.java | 3 + .../spockframework/compiler/SpecRewriter.java | 2 +- .../mock/TooFewInvocationsError.java | 2 +- .../mock/runtime/MockController.java | 10 ++- .../mock/GlobalInteractionsInCleanup.groovy | 62 +++++++++++++++++++ ...are_used_in_AST_transformation-groovy4.txt | 2 +- ...are_used_in_AST_transformation-groovy5.txt | 2 +- ...e_types_are_used_in_AST_transformation.txt | 2 +- ...ceFeatureBody_can_render_everything.groovy | 2 +- ...n_render_everything__Groovy_4_0_2__.groovy | 2 +- ...thods_and_its_annotation_by_default.groovy | 2 +- ...ers_and_their_annotation_by_default.groovy | 2 +- ...servable_blocks_with_GString_labels.groovy | 2 +- ...observable_blocks_with_empty_labels.groovy | 2 +- ...vable_blocks_with_labels_and_blocks.groovy | 2 +- ...rite_keeps_correct_method_reference.groovy | 2 +- ...rence_for_multi_assignments-groovy5.groovy | 2 +- ...hod_reference_for_multi_assignments.groovy | 2 +- .../DataAstSpec/multi_parameterization.groovy | 2 +- .../nested_multi_parameterization.groovy | 2 +- ...ith__separators_can_be_combined-[0].groovy | 2 +- ...ith__separators_can_be_combined-[1].groovy | 2 +- ...ith__separators_can_be_combined-[2].groovy | 2 +- ...filter_block_becomes_its_own_method.groovy | 2 +- ...e_in_a_cell_multiple_times_compiles.groovy | 2 +- ...tionsAsSet_is_transformed_correctly.groovy | 2 +- ...InAnyOrder_is_transformed_correctly.groovy | 2 +- ...onditions_are_transformed_correctly.groovy | 2 +- ...onditions_are_transformed_correctly.groovy | 2 +- ...ilt_in_method_as_explicit_condition.groovy | 2 +- ...ilt_in_method_as_implicit_condition.groovy | 2 +- ...ndition_method__conditionMethod-[0].groovy | 2 +- ...ndition_method__conditionMethod-[1].groovy | 2 +- ...ndition_method__conditionMethod-[2].groovy | 2 +- ..._conditionMethod_with_exception-[0].groovy | 2 +- ..._conditionMethod_with_exception-[1].groovy | 2 +- ..._conditionMethod_with_exception-[2].groovy | 2 +- ...itionMethod_with_only_exception-[0].groovy | 2 +- ...itionMethod_with_only_exception-[1].groovy | 2 +- ...itionMethod_with_only_exception-[2].groovy | 2 +- ...ndition_method__conditionMethod-[0].groovy | 2 +- ...ndition_method__conditionMethod-[1].groovy | 2 +- ...ndition_method__conditionMethod-[2].groovy | 2 +- ..._conditionMethod_with_exception-[0].groovy | 2 +- ..._conditionMethod_with_exception-[1].groovy | 2 +- ..._conditionMethod_with_exception-[2].groovy | 2 +- ...itionMethod_with_only_exception-[0].groovy | 2 +- ...itionMethod_with_only_exception-[1].groovy | 2 +- ...itionMethod_with_only_exception-[2].groovy | 2 +- ...rite_keeps_correct_method_reference.groovy | 2 +- ...rence_for_multi_assignments-groovy5.groovy | 2 +- ...hod_reference_for_multi_assignments.groovy | 2 +- ...eclarations_stay_unchanged_in_specs.groovy | 2 +- ...forms_conditions_in_private_methods.groovy | 2 +- ...eclarations_stay_unchanged_in_specs.groovy | 2 +- ...forms_conditions_in_private_methods.groovy | 2 +- .../MocksAstSpec/simple_interaction.groovy | 2 +- ...er_variable_in_data_provider_method.groovy | 2 +- ...r_variable_in_data_processor_method.groovy | 2 +- 61 files changed, 137 insertions(+), 58 deletions(-) create mode 100644 spock-specs/src/test/groovy/org/spockframework/smoke/mock/GlobalInteractionsInCleanup.groovy diff --git a/docs/interaction_based_testing.adoc b/docs/interaction_based_testing.adoc index 89dc056dbc..cbb3cfbf6b 100644 --- a/docs/interaction_based_testing.adoc +++ b/docs/interaction_based_testing.adoc @@ -444,7 +444,7 @@ This makes sure that `subscriber` receives `"message1"` during execution of the and `"message2"` during execution of the second `when:` block. Interactions declared outside a `then:` block are active from their declaration until the end of the -containing feature method. +containing feature method plus an eventually existing `cleanup` method. Interactions are always scoped to a particular feature method. Hence they cannot be declared in a static method, `setupSpec` method, or `cleanupSpec` method. Likewise, mock objects should not be stored in static or `@Shared` diff --git a/docs/release_notes.adoc b/docs/release_notes.adoc index 66acbc5fef..38de4eaac2 100644 --- a/docs/release_notes.adoc +++ b/docs/release_notes.adoc @@ -19,6 +19,12 @@ include::include.adoc[] === Breaking Changes * Mock/Stub checks on `Comparable` with `T` being something other than `Object` now compare using the java identity hash code instead of always being equal spockIssue:2352[] +* Interactions outside a `then:` block are now still active in an eventually existing `cleanup` method. + If the interaction contains a lower cardinality, this is still checked at the end of the feature method. + Upper cardinality is still relevant in the `cleanup` method, so could cause test failures where previously simply the default response of the mock object was used without cardinality check and could now cause previously working tests to fail. + This enables `cleanup` methods to get stubbed responses from mock objects which previously was only possible by using a custom default response. + If an interaction with stubbed response is present, the default response is also no longer used in the `cleanup` method because the interaction's stubbed response is used now, which could also cause existing tests to fail. + spockIssue:616[] == 2.4 (2025-12-11) diff --git a/spock-core/src/main/java/org/spockframework/compiler/AstNodeCache.java b/spock-core/src/main/java/org/spockframework/compiler/AstNodeCache.java index 061d38c8d4..4be56bdd34 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/AstNodeCache.java +++ b/spock-core/src/main/java/org/spockframework/compiler/AstNodeCache.java @@ -107,6 +107,9 @@ public class AstNodeCache { public final MethodNode MockController_LeaveScope = MockController.getDeclaredMethods(org.spockframework.mock.runtime.MockController.LEAVE_SCOPE).get(0); + public final MethodNode MockController_VerifyLastScope = + MockController.getDeclaredMethods(org.spockframework.mock.runtime.MockController.VERIFY_LAST_SCOPE).get(0); + public final MethodNode SpecificationContext_GetMockController = SpecificationContext.getDeclaredMethods(org.spockframework.runtime.SpecificationContext.GET_MOCK_CONTROLLER).get(0); diff --git a/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java b/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java index 1911fe7c72..8be9eaead2 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java +++ b/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java @@ -410,7 +410,7 @@ public void visitMethodAgain(Method method) { // for global required interactions if (method instanceof FeatureMethod) { - method.getStatements().add(createMockControllerCall(nodeCache.MockController_LeaveScope)); + method.getStatements().add(createMockControllerCall(nodeCache.MockController_VerifyLastScope)); } if (method instanceof VerifyAllMethod) { diff --git a/spock-core/src/main/java/org/spockframework/mock/TooFewInvocationsError.java b/spock-core/src/main/java/org/spockframework/mock/TooFewInvocationsError.java index 1bee5fd09a..5b91e87967 100644 --- a/spock-core/src/main/java/org/spockframework/mock/TooFewInvocationsError.java +++ b/spock-core/src/main/java/org/spockframework/mock/TooFewInvocationsError.java @@ -37,7 +37,7 @@ public TooFewInvocationsError(List interactions, List 0); this.interactions = interactions; - this.unmatchedInvocations = unmatchedInvocations; + this.unmatchedInvocations = new ArrayList<>(unmatchedInvocations); } @Override diff --git a/spock-core/src/main/java/org/spockframework/mock/runtime/MockController.java b/spock-core/src/main/java/org/spockframework/mock/runtime/MockController.java index e49c625f60..5a20714a17 100644 --- a/spock-core/src/main/java/org/spockframework/mock/runtime/MockController.java +++ b/spock-core/src/main/java/org/spockframework/mock/runtime/MockController.java @@ -17,7 +17,7 @@ package org.spockframework.mock.runtime; import org.spockframework.mock.*; -import org.spockframework.util.Checks; +import org.spockframework.util.Assert; import org.spockframework.util.ExceptionUtil; import java.util.*; @@ -110,6 +110,14 @@ public synchronized void leaveScope() { scope.verifyInteractions(); } + public static final String VERIFY_LAST_SCOPE = "verifyLastScope"; + + public synchronized void verifyLastScope() { + throwAnyPreviousError(); + Assert.that(scopes.size() == 1, () -> "There should be exactly one scope left, but there were " + scopes.size()); + scopes.getFirst().verifyInteractions(); + } + private void throwAnyPreviousError() { if (!errors.isEmpty()) throw errors.get(0); } diff --git a/spock-specs/src/test/groovy/org/spockframework/smoke/mock/GlobalInteractionsInCleanup.groovy b/spock-specs/src/test/groovy/org/spockframework/smoke/mock/GlobalInteractionsInCleanup.groovy new file mode 100644 index 0000000000..faefbfe30a --- /dev/null +++ b/spock-specs/src/test/groovy/org/spockframework/smoke/mock/GlobalInteractionsInCleanup.groovy @@ -0,0 +1,62 @@ +/* + * Copyright 2026 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.spockframework.smoke.mock + +import org.spockframework.runtime.ConditionNotSatisfiedError +import spock.lang.FailsWith +import spock.lang.Issue +import spock.lang.Specification + +import java.util.function.Function + +@Issue("https://github.com/spockframework/spock/issues/616") +class GlobalInteractionsInCleanup extends Specification { + def mock = Mock(Function) + def mock2 = Mock(Function) { + apply("a") >> { "c" } + } + def mock3 = Mock(Function) + + def setup() { + mock.apply("a") >> { "b" } + } + + def cleanup() { + verifyAll { + mock.apply("a") == "b" + mock2.apply("a") == "c" + mock3.apply("a") == "d" + } + } + + def "run a successful test"() { + given: + mock3.apply("a") >> { "d" } + + expect: + true + } + + @FailsWith(ConditionNotSatisfiedError) + def "run a failing test"() { + given: + mock3.apply("a") >> { "d" } + + expect: + false + } +} diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy4.txt b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy4.txt index 40502c0621..032f2c0b60 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy4.txt +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy4.txt @@ -208,7 +208,7 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - INVOKEVIRTUAL org/spockframework/mock/runtime/MockController.leaveScope ()V + INVOKEVIRTUAL org/spockframework/mock/runtime/MockController.verifyLastScope ()V ACONST_NULL POP L18 diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy5.txt b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy5.txt index e814a4c5a0..497c8708db 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy5.txt +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation-groovy5.txt @@ -184,7 +184,7 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - INVOKEVIRTUAL org/spockframework/mock/runtime/MockController.leaveScope ()V + INVOKEVIRTUAL org/spockframework/mock/runtime/MockController.verifyLastScope ()V L18 LINENUMBER 9 L18 RETURN diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation.txt b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation.txt index 0ef9f26521..c075f472d1 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation.txt +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation.txt @@ -181,7 +181,7 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov LDC Lorg/spockframework/mock/runtime/MockController;.class INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; CHECKCAST org/spockframework/mock/runtime/MockController - INVOKEVIRTUAL org/spockframework/mock/runtime/MockController.leaveScope ()V + INVOKEVIRTUAL org/spockframework/mock/runtime/MockController.verifyLastScope ()V ACONST_NULL POP L18 diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy index 7ffba1c2db..48c8867ad5 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy @@ -10,7 +10,7 @@ public class apackage.ASpec extends spock.lang.Specification { org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) java.lang.Object nothing = null org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy index fd88bc3283..2c67706e02 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy @@ -10,7 +10,7 @@ public class apackage.ASpec extends spock.lang.Specification implements groovy.l org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) java.lang.Object nothing = null org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy index dd6b84996a..d4d2379369 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy @@ -9,7 +9,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) java.lang.Object nothing = null org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy index 6e4e7d6fae..d7166674c0 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy @@ -15,7 +15,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) java.lang.Object nothing = null org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy index 47f392af38..eb246833e9 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy @@ -33,7 +33,7 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 3) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy index a8d52bacf0..c7b4972adc 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy @@ -43,7 +43,7 @@ public void $spock_feature_0_0() { } } } - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy index a22c5e5f8a..8d25d73049 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy @@ -45,7 +45,7 @@ public void $spock_feature_0_0() { } } } - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy index 998f45c957..b24e40d67b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy @@ -53,7 +53,7 @@ public void $spock_feature_0_0() { } } } - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy index 5c01756509..2de00c1c48 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy @@ -53,7 +53,7 @@ public void $spock_feature_0_0() { } } } - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy index f1fe748522..b81099ed56 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy @@ -53,7 +53,7 @@ public void $spock_feature_0_0() { } } } - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy index 877d7c94f4..5c3c8dfbba 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy @@ -17,7 +17,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } @org.spockframework.runtime.model.DataProviderMetadata(line = 3, dataVariables = ['a', 'b']) diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy index a1554f2bf2..eceeb1d183 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy @@ -17,7 +17,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } @org.spockframework.runtime.model.DataProviderMetadata(line = 3, dataVariables = ['a', 'b']) diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy index 16bbdc8d9d..29301e118b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy @@ -16,7 +16,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } public java.lang.Object $spock_feature_0_0prov0() { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy index 16bbdc8d9d..29301e118b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy @@ -16,7 +16,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } public java.lang.Object $spock_feature_0_0prov0() { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy index 16bbdc8d9d..29301e118b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy @@ -16,7 +16,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } public java.lang.Object $spock_feature_0_0prov0() { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy index 6e3c8c3c25..88b8c8cbeb 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy @@ -16,7 +16,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } public java.lang.Object $spock_feature_0_0prov0() { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/using_a_variable_in_a_cell_multiple_times_compiles.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/using_a_variable_in_a_cell_multiple_times_compiles.groovy index 80feb36458..593756012b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/using_a_variable_in_a_cell_multiple_times_compiles.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/using_a_variable_in_a_cell_multiple_times_compiles.groovy @@ -16,7 +16,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } public java.lang.Object $spock_feature_0_0prov0() { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy index 0e4b411bf9..a56a5fb75f 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy @@ -20,7 +20,7 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 1) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy index 886151feb5..7be87c3def 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy @@ -20,7 +20,7 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 1) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy index 4c10251826..0739f6762e 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy @@ -20,7 +20,7 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 1) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy index d57648251b..2cf4210fe7 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy @@ -20,7 +20,7 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 1) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy index e611e01b8b..86a5c4d7ed 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy @@ -13,5 +13,5 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy index bf75b06bac..0a1a91b420 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy @@ -13,5 +13,5 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy index c97c9d6e24..6147729822 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy @@ -13,5 +13,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy index 31f7332824..d18032913f 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy @@ -17,5 +17,5 @@ public void $spock_feature_0_0() { $spock_errorCollector1.validateCollectedErrors()} }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy index 52f29ac909..45cc299b94 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy @@ -13,5 +13,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy index 3dfadc55b6..27a1166db7 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy @@ -14,5 +14,5 @@ public void $spock_feature_0_0() { throw new java.lang.Exception('foo') }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy index ee29dea335..8147268366 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy @@ -18,5 +18,5 @@ public void $spock_feature_0_0() { $spock_errorCollector1.validateCollectedErrors()} }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy index f28f80ce8b..06386fd0a9 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy @@ -14,5 +14,5 @@ public void $spock_feature_0_0() { throw new java.lang.Exception('foo') }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy index 600a99145f..f3be3a0aa4 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy @@ -5,5 +5,5 @@ public void $spock_feature_0_0() { throw new java.lang.Exception('foo') }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy index 022253fdd2..7368d293ff 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy @@ -5,5 +5,5 @@ public void $spock_feature_0_0() { throw new java.lang.Exception('foo') }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy index 4ffd94652e..f7ba0cb9e2 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy @@ -5,5 +5,5 @@ public void $spock_feature_0_0() { throw new java.lang.Exception('foo') }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy index d97957c82b..5860086f96 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy @@ -22,5 +22,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy index 35791d6e7a..19586eb91b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy @@ -31,5 +31,5 @@ public void $spock_feature_0_0() { $spock_errorCollector1.validateCollectedErrors()} }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy index 862c8f93f0..f85bd6b44b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy @@ -22,5 +22,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy index bb7f8920ad..dcf74a378b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy @@ -23,5 +23,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy index 7d541a6c46..b8f84b21ca 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy @@ -32,5 +32,5 @@ public void $spock_feature_0_0() { $spock_errorCollector1.validateCollectedErrors()} }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy index d9903c6e49..8ddab7af37 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy @@ -23,5 +23,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy index 883aaf44f0..42c428fe1d 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy @@ -15,5 +15,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy index 363db57aa4..454f782985 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy @@ -19,5 +19,5 @@ public void $spock_feature_0_0() { $spock_errorCollector1.validateCollectedErrors()} }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy index 4078772382..500fa55c8c 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy @@ -15,5 +15,5 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy index 6cd5d1d06a..2fd8b5e57b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy @@ -23,7 +23,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 1) org.spockframework.runtime.SpecInternals.thrownImpl(this, null, null, java.lang.IllegalStateException) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 1) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy index 6181b9e2ec..cf555e9920 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments-groovy5.groovy @@ -23,7 +23,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 1) org.spockframework.runtime.SpecInternals.thrownImpl(this, null, null, java.lang.IllegalStateException) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 1) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy index 6bf8c68aec..f901144aaf 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy @@ -23,7 +23,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 1) org.spockframework.runtime.SpecInternals.thrownImpl(this, null, null, java.lang.IllegalStateException) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 1) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy index 9cba58f280..b5b98fe155 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy @@ -21,7 +21,7 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/transforms_conditions_in_private_methods.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/transforms_conditions_in_private_methods.groovy index 929c588668..0dd9196669 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/transforms_conditions_in_private_methods.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/transforms_conditions_in_private_methods.groovy @@ -112,7 +112,7 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy index 2060dc4c48..a40b84fa0b 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/methods_without_condition_declarations_stay_unchanged_in_specs.groovy @@ -21,7 +21,7 @@ public void $spock_feature_0_0() { finally { } org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/transforms_conditions_in_private_methods.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/transforms_conditions_in_private_methods.groovy index ff11d7b6a3..0b60acbdb0 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/transforms_conditions_in_private_methods.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/transforms_conditions_in_private_methods.groovy @@ -108,7 +108,7 @@ public void $spock_feature_0_0() { } }) org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy index 2b63ee3b75..5ce312e6b2 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy @@ -17,7 +17,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 2) this.getSpecificationContext().getMockController().leaveScope() org.spockframework.runtime.SpockRuntime.callBlockExited(this, 2) - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } /*--------- end::snapshot[] ---------*/ } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_provider_with_asserting_closure_produces_error_rethrower_variable_in_data_provider_method.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_provider_with_asserting_closure_produces_error_rethrower_variable_in_data_provider_method.groovy index f5929cc270..f5ebc6c8f9 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_provider_with_asserting_closure_produces_error_rethrower_variable_in_data_provider_method.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_provider_with_asserting_closure_produces_error_rethrower_variable_in_data_provider_method.groovy @@ -4,7 +4,7 @@ import spock.lang.* class ASpec extends Specification { /*--------- tag::snapshot[] ---------*/ public void $spock_feature_0_0(java.lang.Object dataPipe, java.lang.Object dataVariable) { - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } public java.lang.Object $spock_feature_0_0prov0() { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_variable_with_asserting_closure_produces_error_rethrower_variable_in_data_processor_method.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_variable_with_asserting_closure_produces_error_rethrower_variable_in_data_processor_method.groovy index 97a553191b..65cc28f950 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_variable_with_asserting_closure_produces_error_rethrower_variable_in_data_processor_method.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataProviders/data_variable_with_asserting_closure_produces_error_rethrower_variable_in_data_processor_method.groovy @@ -4,7 +4,7 @@ import spock.lang.* class ASpec extends Specification { /*--------- tag::snapshot[] ---------*/ public void $spock_feature_0_0(java.lang.Object dataPipe, java.lang.Object dataVariable) { - this.getSpecificationContext().getMockController().leaveScope() + this.getSpecificationContext().getMockController().verifyLastScope() } public java.lang.Object $spock_feature_0_0prov0() {