├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── actions │ ├── setup-build-env │ │ └── action.yml │ └── setup-jdks │ │ └── action.yml ├── codecov.yml ├── renovate.json5 └── workflows │ ├── README.adoc │ ├── branches-and-prs.main.kts │ ├── branches-and-prs.yaml │ ├── codeql-analysis.main.kts │ ├── codeql-analysis.yaml │ ├── common.main.kts │ ├── docs-pr.main.kts │ ├── docs-pr.yaml │ ├── release.main.kts │ └── release.yaml ├── .idea ├── codeStyleSettings.xml ├── copyright │ ├── ASLv2.xml │ └── profiles_settings.xml ├── groovyc.xml ├── icon.png └── vcs.xml ├── CONTRIBUTING.adoc ├── LICENSE ├── NOTICE ├── README.adoc ├── allVariants ├── allVariants.bat ├── build-logic ├── asciidoc-extensions │ ├── asciidoc-extensions.gradle │ └── src │ │ └── main │ │ ├── java │ │ └── org │ │ │ └── spockframework │ │ │ └── plugins │ │ │ └── asciidoctor │ │ │ ├── IncludedSourceLinker.java │ │ │ ├── SpockExtension.java │ │ │ ├── SpockIssueInlineMacroProcessor.java │ │ │ └── SpockPullInlineMacroProcessor.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.asciidoctor.jruby.extension.spi.ExtensionRegistry ├── base │ ├── base.gradle │ └── src │ │ ├── main │ │ └── groovy │ │ │ └── org │ │ │ └── spockframework │ │ │ └── gradle │ │ │ ├── AsciiDocLinkVerifier.groovy │ │ │ ├── JacocoJavaagentProvider.groovy │ │ │ ├── SpockBasePlugin.groovy │ │ │ └── SpockConfigArgumentProvider.groovy │ │ └── test │ │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── gradle │ │ ├── AsciiDocLinkVerifierTest.groovy │ │ └── SpockBasePluginSpec.groovy ├── build-logic.gradle ├── preprocess-workflows │ ├── preprocess-workflows.gradle │ └── src │ │ └── main │ │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── gradle │ │ ├── DetermineImportedFiles.groovy │ │ ├── DetermineImportedFilesWorkAction.groovy │ │ ├── PreprocessGithubWorkflow.groovy │ │ ├── PreprocessGithubWorkflowWorkAction.groovy │ │ └── PreprocessWorkflowsPlugin.groovy └── settings.gradle ├── build.gradle ├── config ├── code-signing-secring.gpg └── nohttp │ ├── allowlist.lines │ └── checkstyle.xml ├── docs ├── all_in_one.adoc ├── data_driven_testing.adoc ├── docinfo.html ├── extensions.adoc ├── faq.adoc ├── getting_started.adoc ├── images │ ├── Blocks2Phases.png │ ├── Spock Logo Use Guidelines.txt │ ├── spock-main-logo.png │ ├── spock-main-logo.svg │ ├── spock_interceptors.png │ └── spock_interceptors.svg ├── include.adoc ├── index.adoc ├── interaction_based_testing.adoc ├── introduction.adoc ├── known_issues.adoc ├── migration_guide.adoc ├── module_spring.adoc ├── modules.adoc ├── parallel_execution.adoc ├── release_notes.adoc ├── spock_primer.adoc └── utilities.adoc ├── gradle.properties ├── gradle ├── ide.gradle ├── libs.versions.toml ├── publishMaven.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── javadoc ├── hamcrest-2.2 │ └── package-list └── java-8 │ └── package-list ├── jitpack.yml ├── settings.gradle ├── spock-bom └── bom.gradle ├── spock-core ├── CoreConsole.groovy ├── core.gradle └── src │ └── main │ ├── groovy │ ├── org │ │ └── spockframework │ │ │ └── util │ │ │ └── GroovyUtil.groovy │ └── spock │ │ └── util │ │ ├── EmbeddedSpecCompiler.groovy │ │ ├── EmbeddedSpecRunner.groovy │ │ ├── SourceToAstNodeAndSourceTranspiler.groovy │ │ ├── concurrent │ │ └── BlockingVariables.groovy │ │ └── matcher │ │ ├── HamcrestMatchers.groovy │ │ └── IsCloseTo.groovy │ ├── java │ ├── org │ │ └── spockframework │ │ │ ├── builder │ │ │ ├── AddSlotFactory.java │ │ │ ├── BuilderHelper.java │ │ │ ├── ClosureBlueprint.java │ │ │ ├── CollectionSlot.java │ │ │ ├── CollectionSlotFactory.java │ │ │ ├── DelegatingScript.java │ │ │ ├── DelegatingScriptBlueprint.java │ │ │ ├── GestaltBuilder.java │ │ │ ├── IBlueprint.java │ │ │ ├── IGestalt.java │ │ │ ├── ISlot.java │ │ │ ├── ISlotFactory.java │ │ │ ├── PojoBuilder.java │ │ │ ├── PojoGestalt.java │ │ │ ├── PropertySlot.java │ │ │ ├── Sculpturer.java │ │ │ ├── SetterLikeSlot.java │ │ │ ├── SetterSlotFactory.java │ │ │ └── SpockConfigurationGestalt.java │ │ │ ├── buildsupport │ │ │ ├── AsmClassReader.java │ │ │ ├── EmptyAnnotationVisitor.java │ │ │ ├── SpecClassFileFinder.java │ │ │ └── SpecClassFileVisitor.java │ │ │ ├── compat │ │ │ └── groovy2 │ │ │ │ └── GroovyCodeVisitorCompat.java │ │ │ ├── compiler │ │ │ ├── AbstractDeepBlockRewriter.java │ │ │ ├── AbstractSpecVisitor.java │ │ │ ├── AstNodeCache.java │ │ │ ├── AstUtil.java │ │ │ ├── ConditionRewriter.java │ │ │ ├── DeepBlockRewriter.java │ │ │ ├── ErrorReporter.java │ │ │ ├── ErrorRethrowerUsageDetector.java │ │ │ ├── ExpressionReplacingVisitorSupport.java │ │ │ ├── FieldInitializationExpression.java │ │ │ ├── IRewriteResources.java │ │ │ ├── ISpecRewriteResources.java │ │ │ ├── ISpecialMethodCall.java │ │ │ ├── InstanceFieldAccessChecker.java │ │ │ ├── InteractionRewriter.java │ │ │ ├── InvalidSpecCompileException.java │ │ │ ├── NoSpecialMethodCall.java │ │ │ ├── OldValueExpression.java │ │ │ ├── SourceLookup.java │ │ │ ├── SpecAnnotator.java │ │ │ ├── SpecParser.java │ │ │ ├── SpecRewriter.java │ │ │ ├── SpecialMethodCall.java │ │ │ ├── SpockNames.java │ │ │ ├── SpockTransform.java │ │ │ ├── StatementReplacingVisitorSupport.java │ │ │ ├── WhereBlockRewriter.java │ │ │ ├── condition │ │ │ │ ├── BaseVerifyMethodRewriter.java │ │ │ │ ├── BaseVerifyMethodTransform.java │ │ │ │ ├── DefaultConditionErrorRecorders.java │ │ │ │ ├── DefaultConditionRewriterResources.java │ │ │ │ ├── IConditionErrorRecorders.java │ │ │ │ ├── IVerifyMethodRewriter.java │ │ │ │ ├── ImplicitConditionsUtils.java │ │ │ │ ├── VerifyAllMethodRewriter.java │ │ │ │ ├── VerifyAllMethodTransform.java │ │ │ │ ├── VerifyMethodRewriter.java │ │ │ │ └── VerifyMethodTransform.java │ │ │ └── model │ │ │ │ ├── AnonymousBlock.java │ │ │ │ ├── Block.java │ │ │ │ ├── BlockParseInfo.java │ │ │ │ ├── CleanupBlock.java │ │ │ │ ├── ExpectBlock.java │ │ │ │ ├── FeatureMethod.java │ │ │ │ ├── Field.java │ │ │ │ ├── FilterBlock.java │ │ │ │ ├── FixtureMethod.java │ │ │ │ ├── HelperMethod.java │ │ │ │ ├── ISpecVisitor.java │ │ │ │ ├── Method.java │ │ │ │ ├── Node.java │ │ │ │ ├── SetupBlock.java │ │ │ │ ├── Spec.java │ │ │ │ ├── ThenBlock.java │ │ │ │ ├── WhenBlock.java │ │ │ │ └── WhereBlock.java │ │ │ ├── lang │ │ │ ├── ConditionBlock.java │ │ │ ├── ISpecificationContext.java │ │ │ ├── SpecInternals.java │ │ │ ├── SpreadWildcard.java │ │ │ └── Wildcard.java │ │ │ ├── mock │ │ │ ├── CallRealMethodResponse.java │ │ │ ├── CannotCreateMockException.java │ │ │ ├── CannotInvokeRealMethodException.java │ │ │ ├── ClosureParameterTypeFromVariableType.java │ │ │ ├── DefaultCompareToInteraction.java │ │ │ ├── DefaultEqualsInteraction.java │ │ │ ├── DefaultFinalizeInteraction.java │ │ │ ├── DefaultHashCodeInteraction.java │ │ │ ├── DefaultInteraction.java │ │ │ ├── DefaultJavaLangObjectInteractions.java │ │ │ ├── DefaultToStringInteraction.java │ │ │ ├── EmptyOrDummyResponse.java │ │ │ ├── IArgumentConstraint.java │ │ │ ├── IChainableResponseGenerator.java │ │ │ ├── IDefaultResponse.java │ │ │ ├── IInteractionAware.java │ │ │ ├── IInteractionScope.java │ │ │ ├── IInvocationConstraint.java │ │ │ ├── IMockConfiguration.java │ │ │ ├── IMockController.java │ │ │ ├── IMockFactory.java │ │ │ ├── IMockInteraction.java │ │ │ ├── IMockInvocation.java │ │ │ ├── IMockMethod.java │ │ │ ├── IMockObject.java │ │ │ ├── IResponseGenerator.java │ │ │ ├── ISpockMockObject.java │ │ │ ├── IThreadAwareMockController.java │ │ │ ├── InteractionNotSatisfiedError.java │ │ │ ├── MockImplementation.java │ │ │ ├── MockNature.java │ │ │ ├── MockUtil.java │ │ │ ├── TooFewInvocationsError.java │ │ │ ├── TooManyInvocationsError.java │ │ │ ├── WrongInvocationOrderError.java │ │ │ ├── ZeroOrNullResponse.java │ │ │ ├── codegen │ │ │ │ └── Target.java │ │ │ ├── constraint │ │ │ │ ├── CodeArgumentConstraint.java │ │ │ │ ├── EqualArgumentConstraint.java │ │ │ │ ├── EqualMethodNameConstraint.java │ │ │ │ ├── EqualPropertyNameConstraint.java │ │ │ │ ├── NamedArgumentListConstraint.java │ │ │ │ ├── NegatingArgumentConstraint.java │ │ │ │ ├── PositionalArgumentListConstraint.java │ │ │ │ ├── PropertyNameConstraint.java │ │ │ │ ├── RegexMethodNameConstraint.java │ │ │ │ ├── RegexPropertyNameConstraint.java │ │ │ │ ├── SpreadWildcardArgumentConstraint.java │ │ │ │ ├── TargetConstraint.java │ │ │ │ ├── TypeArgumentConstraint.java │ │ │ │ ├── WildcardArgumentConstraint.java │ │ │ │ └── WildcardMethodNameConstraint.java │ │ │ ├── package-info.java │ │ │ ├── response │ │ │ │ ├── CodeResponseGenerator.java │ │ │ │ ├── ConstantResponseGenerator.java │ │ │ │ ├── DefaultResponseGenerator.java │ │ │ │ ├── IterableResponseGenerator.java │ │ │ │ ├── ResponseGeneratorChain.java │ │ │ │ ├── SingleResponseGenerator.java │ │ │ │ └── WildcardResponseGenerator.java │ │ │ └── runtime │ │ │ │ ├── BaseMockInterceptor.java │ │ │ │ ├── ByteBuddyInterceptorAdapter.java │ │ │ │ ├── ByteBuddyInvoker.java │ │ │ │ ├── ByteBuddyMethodInvoker.java │ │ │ │ ├── ByteBuddyMockFactory.java │ │ │ │ ├── ByteBuddyMockInteractionValidator.java │ │ │ │ ├── ByteBuddyMockMaker.java │ │ │ │ ├── CglibMockFactory.java │ │ │ │ ├── CglibMockInterceptorAdapter.java │ │ │ │ ├── CglibMockMaker.java │ │ │ │ ├── CglibRealMethodInvoker.java │ │ │ │ ├── CompositeMockFactory.java │ │ │ │ ├── DefaultMethodInvoker.java │ │ │ │ ├── DelegatingMockInvocation.java │ │ │ │ ├── DynamicMockMethod.java │ │ │ │ ├── FailingRealMethodInvoker.java │ │ │ │ ├── GroovyMockFactory.java │ │ │ │ ├── GroovyMockInterceptor.java │ │ │ │ ├── GroovyMockMetaClass.java │ │ │ │ ├── GroovyRealMethodInvoker.java │ │ │ │ ├── IMockInteractionValidator.java │ │ │ │ ├── IMockMaker.java │ │ │ │ ├── IProxyBasedMockInterceptor.java │ │ │ │ ├── InteractionBuilder.java │ │ │ │ ├── InteractionScope.java │ │ │ │ ├── JavaMockFactory.java │ │ │ │ ├── JavaMockInterceptor.java │ │ │ │ ├── JavaProxyMockInterceptorAdapter.java │ │ │ │ ├── JavaProxyMockMaker.java │ │ │ │ ├── MockConfiguration.java │ │ │ │ ├── MockController.java │ │ │ │ ├── MockCreationSettings.java │ │ │ │ ├── MockInstantiator.java │ │ │ │ ├── MockInteraction.java │ │ │ │ ├── MockInteractionDecorator.java │ │ │ │ ├── MockInvocation.java │ │ │ │ ├── MockMakerConfiguration.java │ │ │ │ ├── MockMakerRegistry.java │ │ │ │ ├── MockObject.java │ │ │ │ ├── ObjectMethodInvoker.java │ │ │ │ ├── SpecificationAttachable.java │ │ │ │ ├── StaticMockMethod.java │ │ │ │ └── mockito │ │ │ │ ├── MockitoMockMaker.java │ │ │ │ ├── MockitoMockMakerImpl.java │ │ │ │ └── MockitoMockMakerSettings.java │ │ │ ├── report │ │ │ └── log │ │ │ │ └── ReportLogConfiguration.java │ │ │ ├── runtime │ │ │ ├── AbstractRunListener.java │ │ │ ├── AsyncRunListener.java │ │ │ ├── AsyncStandardStreamsListener.java │ │ │ ├── ClassSelectorResolver.java │ │ │ ├── Condition.java │ │ │ ├── ConditionFailedWithExceptionError.java │ │ │ ├── ConditionNotSatisfiedError.java │ │ │ ├── ConfigurationBuilder.java │ │ │ ├── ConfigurationScriptLoader.java │ │ │ ├── DataIteratorFactory.java │ │ │ ├── DataVariablesIterationNameProvider.java │ │ │ ├── DefaultParallelExecutionConfiguration.java │ │ │ ├── DummyStackTraceFilter.java │ │ │ ├── ErrorCollector.java │ │ │ ├── ErrorContext.java │ │ │ ├── ErrorInfoCollector.java │ │ │ ├── ErrorRethrower.java │ │ │ ├── ErrorSpecNode.java │ │ │ ├── ExpressionComparisonRenderer.java │ │ │ ├── ExpressionInfoBuilder.java │ │ │ ├── ExpressionInfoConverter.java │ │ │ ├── ExpressionInfoRenderer.java │ │ │ ├── ExpressionInfoValueRenderer.java │ │ │ ├── ExtensionClassesLoader.java │ │ │ ├── ExtensionRunner.java │ │ │ ├── FailedEqualityComparisonRenderer.java │ │ │ ├── FailedInstanceOfComparisonRenderer.java │ │ │ ├── FailedSetEqualityComparisonRenderer.java │ │ │ ├── FailedStringComparisonRenderer.java │ │ │ ├── FeatureNode.java │ │ │ ├── GlobalExtensionRegistry.java │ │ │ ├── GroovyRuntimeUtil.java │ │ │ ├── HamcrestFacade.java │ │ │ ├── IConfigurationRegistry.java │ │ │ ├── IDataIterator.java │ │ │ ├── IExtensionRegistry.java │ │ │ ├── IFeatureFilter.java │ │ │ ├── IFeatureSortOrder.java │ │ │ ├── IMethodNameMapper.java │ │ │ ├── IRunListener.java │ │ │ ├── IRunSupervisor.java │ │ │ ├── IStackTraceFilter.java │ │ │ ├── IStandardStreamsListener.java │ │ │ ├── InvalidSpecException.java │ │ │ ├── IterationNode.java │ │ │ ├── MasterRunListener.java │ │ │ ├── MasterRunSupervisor.java │ │ │ ├── MethodSelectorResolver.java │ │ │ ├── NamespacedExtensionStore.java │ │ │ ├── ParameterizedFeatureChildExecutor.java │ │ │ ├── ParameterizedFeatureNode.java │ │ │ ├── PlatformParameterizedSpecRunner.java │ │ │ ├── PlatformSpecRunner.java │ │ │ ├── RunContext.java │ │ │ ├── RunStatus.java │ │ │ ├── SafeIterationNameProvider.java │ │ │ ├── SimpleFeatureNode.java │ │ │ ├── SpecInfoBuilder.java │ │ │ ├── SpecNode.java │ │ │ ├── SpecRunHistory.java │ │ │ ├── SpecUtil.java │ │ │ ├── SpecificationContext.java │ │ │ ├── SpockAssertionError.java │ │ │ ├── SpockComparisonFailure.java │ │ │ ├── SpockEngine.java │ │ │ ├── SpockEngineDescriptor.java │ │ │ ├── SpockEngineDiscoveryPostProcessor.java │ │ │ ├── SpockException.java │ │ │ ├── SpockExecution.java │ │ │ ├── SpockExecutionContext.java │ │ │ ├── SpockExecutionException.java │ │ │ ├── SpockMultipleFailuresError.java │ │ │ ├── SpockNode.java │ │ │ ├── SpockRuntime.java │ │ │ ├── SpockTimeoutError.java │ │ │ ├── StackTraceFilter.java │ │ │ ├── StandardStreamsCapturer.java │ │ │ ├── StoreProvider.java │ │ │ ├── UnallowedExceptionThrownError.java │ │ │ ├── ValueRecorder.java │ │ │ ├── WrongExceptionThrownError.java │ │ │ ├── condition │ │ │ │ ├── DiffedArrayRenderer.java │ │ │ │ ├── DiffedClassRenderer.java │ │ │ │ ├── DiffedCollectionRenderer.java │ │ │ │ ├── DiffedMapRenderer.java │ │ │ │ ├── DiffedObjectAsBeanRenderer.java │ │ │ │ ├── DiffedObjectAsStringRenderer.java │ │ │ │ ├── DiffedSetRenderer.java │ │ │ │ ├── EditDistance.java │ │ │ │ ├── EditOperation.java │ │ │ │ ├── EditPathRenderer.java │ │ │ │ ├── IObjectRenderer.java │ │ │ │ ├── IObjectRendererService.java │ │ │ │ ├── LineBuilder.java │ │ │ │ └── ObjectRendererService.java │ │ │ ├── extension │ │ │ │ ├── AbstractAnnotationDrivenExtension.java │ │ │ │ ├── AbstractGlobalExtension.java │ │ │ │ ├── AbstractMethodInterceptor.java │ │ │ │ ├── ExtensionAnnotation.java │ │ │ │ ├── ExtensionException.java │ │ │ │ ├── ExtensionUtil.java │ │ │ │ ├── IAnnotationDrivenExtension.java │ │ │ │ ├── IBlockListener.java │ │ │ │ ├── IDataDriver.java │ │ │ │ ├── IDefaultValueProviderExtension.java │ │ │ │ ├── IGlobalExtension.java │ │ │ │ ├── IIterationRunner.java │ │ │ │ ├── IMethodInterceptor.java │ │ │ │ ├── IMethodInvocation.java │ │ │ │ ├── ISpockExecution.java │ │ │ │ ├── IStatelessAnnotationDrivenExtension.java │ │ │ │ ├── IStore.java │ │ │ │ ├── IStoreProvider.java │ │ │ │ ├── MethodInvocation.java │ │ │ │ ├── ParameterResolver.java │ │ │ │ ├── RepeatedExtensionAnnotations.java │ │ │ │ └── builtin │ │ │ │ │ ├── AutoCleanupExtension.java │ │ │ │ │ ├── AutoCleanupInterceptor.java │ │ │ │ │ ├── ConditionalExtension.java │ │ │ │ │ ├── ConfineMetaClassChangesExtension.java │ │ │ │ │ ├── ConfineMetaClassChangesInterceptor.java │ │ │ │ │ ├── ExecutionExtension.java │ │ │ │ │ ├── FailsWithExtension.java │ │ │ │ │ ├── FailsWithInterceptor.java │ │ │ │ │ ├── GlobalTimeoutExtension.java │ │ │ │ │ ├── IgnoreExtension.java │ │ │ │ │ ├── IgnoreIfExtension.java │ │ │ │ │ ├── IgnoreRestExtension.java │ │ │ │ │ ├── IncludeExcludeExtension.java │ │ │ │ │ ├── IsolatedExtension.java │ │ │ │ │ ├── IssueExtension.java │ │ │ │ │ ├── NarrativeExtension.java │ │ │ │ │ ├── OptimizeRunOrderExtension.java │ │ │ │ │ ├── PendingFeatureBaseInterceptor.java │ │ │ │ │ ├── PendingFeatureExtension.java │ │ │ │ │ ├── PendingFeatureIfExtension.java │ │ │ │ │ ├── PendingFeatureInterceptor.java │ │ │ │ │ ├── PendingFeatureIterationInterceptor.java │ │ │ │ │ ├── PendingFeatureSuccessfulError.java │ │ │ │ │ ├── PreconditionContext.java │ │ │ │ │ ├── RepeatUntilFailureExtension.java │ │ │ │ │ ├── RequiresExtension.java │ │ │ │ │ ├── ResourceLockExtension.java │ │ │ │ │ ├── RestoreSystemPropertiesExtension.java │ │ │ │ │ ├── RestoreSystemPropertiesInterceptor.java │ │ │ │ │ ├── RetryBaseInterceptor.java │ │ │ │ │ ├── RetryConditionContext.java │ │ │ │ │ ├── RetryExtension.java │ │ │ │ │ ├── RetryFeatureInterceptor.java │ │ │ │ │ ├── RetryIterationInterceptor.java │ │ │ │ │ ├── RevertMetaClassRunListener.java │ │ │ │ │ ├── SeeExtension.java │ │ │ │ │ ├── SnapshotConfig.java │ │ │ │ │ ├── SnapshotExtension.java │ │ │ │ │ ├── StepwiseExtension.java │ │ │ │ │ ├── TagExtension.java │ │ │ │ │ ├── TempDirExtension.java │ │ │ │ │ ├── TempDirInterceptor.java │ │ │ │ │ ├── ThreadDumpUtility.java │ │ │ │ │ ├── ThreadDumpUtilityType.java │ │ │ │ │ ├── TimeoutConfiguration.java │ │ │ │ │ ├── TimeoutExtension.java │ │ │ │ │ ├── TimeoutInterceptor.java │ │ │ │ │ ├── TitleExtension.java │ │ │ │ │ ├── UnrollConfiguration.java │ │ │ │ │ ├── UnrollExtension.java │ │ │ │ │ ├── UnrollIterationNameProvider.java │ │ │ │ │ ├── UseExtension.java │ │ │ │ │ └── UseInterceptor.java │ │ │ └── model │ │ │ │ ├── Attachment.java │ │ │ │ ├── BlockInfo.java │ │ │ │ ├── BlockKind.java │ │ │ │ ├── BlockMetadata.java │ │ │ │ ├── DataProcessorMetadata.java │ │ │ │ ├── DataProviderInfo.java │ │ │ │ ├── DataProviderMetadata.java │ │ │ │ ├── DataVariableMultiplication.java │ │ │ │ ├── DataVariableMultiplicationFactor.java │ │ │ │ ├── ErrorInfo.java │ │ │ │ ├── ExecutionResult.java │ │ │ │ ├── ExpressionInfo.java │ │ │ │ ├── FeatureInfo.java │ │ │ │ ├── FeatureMetadata.java │ │ │ │ ├── FieldInfo.java │ │ │ │ ├── FieldMetadata.java │ │ │ │ ├── IAttachmentContainer.java │ │ │ │ ├── IErrorContext.java │ │ │ │ ├── IExcludable.java │ │ │ │ ├── IInterceptable.java │ │ │ │ ├── INameable.java │ │ │ │ ├── IParallelInfo.java │ │ │ │ ├── ISkippable.java │ │ │ │ ├── ITaggable.java │ │ │ │ ├── ITestTaggable.java │ │ │ │ ├── Invoker.java │ │ │ │ ├── IterationFilter.java │ │ │ │ ├── IterationInfo.java │ │ │ │ ├── MethodInfo.java │ │ │ │ ├── MethodKind.java │ │ │ │ ├── NameProvider.java │ │ │ │ ├── NodeInfo.java │ │ │ │ ├── ParameterInfo.java │ │ │ │ ├── SpecElementInfo.java │ │ │ │ ├── SpecInfo.java │ │ │ │ ├── SpecMetadata.java │ │ │ │ ├── Tag.java │ │ │ │ ├── TestTag.java │ │ │ │ ├── TextPosition.java │ │ │ │ ├── TextRegion.java │ │ │ │ └── parallel │ │ │ │ ├── ExclusiveResource.java │ │ │ │ ├── ExecutionMode.java │ │ │ │ ├── ResourceAccessMode.java │ │ │ │ └── Resources.java │ │ │ ├── tempdir │ │ │ └── TempDirConfiguration.java │ │ │ └── util │ │ │ ├── AbstractExpressionConverter.java │ │ │ ├── AbstractMultiset.java │ │ │ ├── Assert.java │ │ │ ├── Beta.java │ │ │ ├── Checks.java │ │ │ ├── CollectionUtil.java │ │ │ ├── ConsoleUtil.java │ │ │ ├── DataVariableMap.java │ │ │ ├── ExceptionUtil.java │ │ │ ├── Filter.java │ │ │ ├── GenericTypeReflectorUtil.java │ │ │ ├── GroovyReleaseInfo.java │ │ │ ├── HashMultiset.java │ │ │ ├── IFunction.java │ │ │ ├── IMatcher.java │ │ │ ├── IMultiset.java │ │ │ ├── IStoppable.java │ │ │ ├── IThrowableBiConsumer.java │ │ │ ├── IThrowableFunction.java │ │ │ ├── Identifiers.java │ │ │ ├── Immutable.java │ │ │ ├── IncompatibleGroovyVersionException.java │ │ │ ├── InternalIdentifiers.java │ │ │ ├── InternalSpockError.java │ │ │ ├── IoUtil.java │ │ │ ├── JavaProcessThreadDumpCollector.java │ │ │ ├── JsonWriter.java │ │ │ ├── LinkedHashMultiset.java │ │ │ ├── Matchers.java │ │ │ ├── MopUtil.java │ │ │ ├── NotThreadSafe.java │ │ │ ├── Nullable.java │ │ │ ├── ObjectUtil.java │ │ │ ├── Pair.java │ │ │ ├── ReflectionUtil.java │ │ │ ├── RenderUtil.java │ │ │ ├── SpockDocLinks.java │ │ │ ├── SpockReleaseInfo.java │ │ │ ├── SpockUserHomeUtil.java │ │ │ ├── StringMessagePrintStream.java │ │ │ ├── TeePrintStream.java │ │ │ ├── TextUtil.java │ │ │ ├── ThreadSafe.java │ │ │ ├── ThreadSupport.java │ │ │ ├── TimeUtil.java │ │ │ ├── UnreachableCodeError.java │ │ │ ├── VersionChecker.java │ │ │ ├── VersionNumber.java │ │ │ ├── WrappedException.java │ │ │ └── inspector │ │ │ ├── AstInspector.java │ │ │ ├── AstInspectorException.java │ │ │ └── Inspect.java │ └── spock │ │ ├── config │ │ ├── ConfigurationException.java │ │ ├── ConfigurationObject.java │ │ ├── IncludeExcludeCriteria.java │ │ ├── ParallelConfiguration.java │ │ ├── RunnerConfiguration.java │ │ └── package-info.java │ │ ├── lang │ │ ├── AutoCleanup.java │ │ ├── Execution.java │ │ ├── FailsWith.java │ │ ├── Ignore.java │ │ ├── IgnoreIf.java │ │ ├── IgnoreRest.java │ │ ├── Isolated.java │ │ ├── Issue.java │ │ ├── Narrative.java │ │ ├── PendingFeature.java │ │ ├── PendingFeatureIf.java │ │ ├── RepeatUntilFailure.java │ │ ├── Requires.java │ │ ├── ResourceLock.java │ │ ├── Retry.java │ │ ├── Rollup.java │ │ ├── See.java │ │ ├── Shared.java │ │ ├── Snapshot.java │ │ ├── Snapshotter.java │ │ ├── Specification.java │ │ ├── Stepwise.java │ │ ├── Subject.java │ │ ├── Tag.java │ │ ├── TempDir.java │ │ ├── Timeout.java │ │ ├── Title.java │ │ ├── Unroll.java │ │ ├── Verify.java │ │ ├── VerifyAll.java │ │ └── package-info.java │ │ ├── mock │ │ ├── AutoAttach.java │ │ ├── AutoAttachExtension.java │ │ ├── DetachedMockFactory.java │ │ ├── IMockMakerSettings.java │ │ ├── MockFactory.java │ │ ├── MockMakerId.java │ │ ├── MockMakers.java │ │ └── MockingApi.java │ │ └── util │ │ ├── Exceptions.java │ │ ├── concurrent │ │ ├── AsyncConditions.java │ │ ├── BlockingVariable.java │ │ ├── BlockingVariablesImpl.java │ │ ├── PollingConditions.java │ │ └── package-info.java │ │ ├── environment │ │ ├── Jvm.java │ │ ├── OperatingSystem.java │ │ ├── RestoreSystemProperties.java │ │ └── package-info.java │ │ ├── io │ │ ├── DirectoryFixture.java │ │ └── FileSystemFixture.java │ │ ├── matcher │ │ ├── HamcrestSupport.java │ │ └── package-info.java │ │ ├── mop │ │ ├── ConfineMetaClassChanges.java │ │ ├── Use.java │ │ └── package-info.java │ │ └── time │ │ └── MutableClock.java │ └── resources │ ├── META-INF │ └── services │ │ ├── org.codehaus.groovy.transform.ASTTransformation │ │ ├── org.junit.platform.engine.TestEngine │ │ ├── org.spockframework.mock.runtime.IMockMaker │ │ ├── org.spockframework.runtime.extension.IGlobalExtension │ │ └── spock.config.ConfigurationObject │ ├── dsld │ └── spock_tests.dsld │ └── org │ └── spockframework │ ├── idea │ └── spock.gdsl │ └── util │ └── SpockReleaseInfo.properties ├── spock-groovy2-compat ├── groovy2-compat.gradle └── src │ └── main │ └── java │ └── org │ └── codehaus │ └── groovy │ └── ast │ └── expr │ ├── LambdaExpression.java │ └── MethodReferenceExpression.java ├── spock-guice ├── guice.gradle └── src │ ├── main │ └── java │ │ ├── org │ │ └── spockframework │ │ │ └── guice │ │ │ ├── GuiceExtension.java │ │ │ ├── GuiceExtensionException.java │ │ │ └── GuiceInterceptor.java │ │ └── spock │ │ └── guice │ │ ├── UseModules.java │ │ └── package-info.java │ └── test │ └── groovy │ └── org │ └── spockframework │ └── guice │ ├── BindingAnnotation1.groovy │ ├── BindingAnnotation2.groovy │ ├── GuiceMultiAnnotations.groovy │ ├── GuiceMultiModules.groovy │ ├── GuiceSpecInheritance.groovy │ ├── IService1.groovy │ ├── IService2.groovy │ ├── InjectionExamples.groovy │ ├── MockModule.groovy │ ├── MockSpec.groovy │ ├── Module1.groovy │ ├── Module2.groovy │ ├── Service1.groovy │ └── Service2.groovy ├── spock-junit4 ├── junit4.gradle └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── spockframework │ │ │ └── junit4 │ │ │ ├── AbstractRuleExtension.java │ │ │ ├── AbstractRuleInterceptor.java │ │ │ ├── ClassRuleExtension.java │ │ │ ├── ClassRuleInterceptor.java │ │ │ ├── ExceptionAdapterExtension.java │ │ │ ├── ExceptionAdapterInterceptor.java │ │ │ ├── JUnit4AnnotationLifecycleMethodsExtension.java │ │ │ ├── JUnitDescriptionGenerator.java │ │ │ ├── MethodRuleInterceptor.java │ │ │ ├── RuleExtension.java │ │ │ └── TestRuleInterceptor.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.spockframework.runtime.extension.IGlobalExtension │ ├── test-groovy-le-3.0 │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── smoke │ │ └── groovy │ │ └── UsageOfDeprecatedNotYetImplemented.groovy │ └── test │ └── groovy │ └── org │ └── spockframework │ ├── groovy │ └── AstInspectorTest.groovy │ ├── junit │ ├── Base.java │ ├── Derived.java │ ├── HelloSpockWithJUnit.java │ └── StringComparison.java │ ├── junit4 │ └── junit │ │ ├── ExceptionAdapterSpec.groovy │ │ ├── HandlingOfAssumptionViolatedException.groovy │ │ ├── JUnitBaseSpec.groovy │ │ ├── JUnitClassRules.groovy │ │ ├── JUnitCompliance.groovy │ │ ├── JUnitDescriptionGeneratorSpec.groovy │ │ ├── JUnitFixtureMethods.groovy │ │ ├── JUnitMethodRuleOrder.groovy │ │ ├── JUnitRules.groovy │ │ ├── JUnitTestRuleOrder.groovy │ │ ├── RulesAndInheritance.groovy │ │ ├── UseJUnitClassRule.groovy │ │ ├── UseJUnitTestNameRule.groovy │ │ └── UseJUnitTimeoutRule.groovy │ ├── smoke │ └── traits │ │ ├── BasicTraitUsageWithJUnit4Annotations.groovy │ │ └── MyTraitWithJUnit4Annotations.groovy │ └── util │ └── IoUtilSpec.groovy ├── spock-specs ├── SpockTestConfig.groovy ├── mock-integration │ ├── mock-integration.gradle │ └── src │ │ └── test │ │ └── groovy │ │ └── MockingIntegrationSpec.groovy ├── specs.gradle └── src │ ├── main │ ├── groovy │ │ └── org │ │ │ └── spockframework │ │ │ └── specs │ │ │ ├── extension │ │ │ └── SpockSnapshotter.groovy │ │ │ └── jacoco │ │ │ └── JacocoAstDumpTrigger.groovy │ └── resources │ │ └── META-INF │ │ └── services │ │ └── org.codehaus.groovy.transform.ASTTransformation │ ├── test-groovy-ge-3.0 │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── smoke │ │ ├── ArrayInitializer.groovy │ │ ├── UsageOfNotYetImplemented.groovy │ │ └── lamba │ │ └── LambdaSpec.groovy │ ├── test-groovy-ge-4.0 │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── smoke │ │ └── condition │ │ └── ConditionG4Spec.groovy │ ├── test-java-ge-17 │ └── java │ │ └── org │ │ └── spockframework │ │ └── smoke │ │ └── mock │ │ ├── IEither.java │ │ └── IMaybe.java │ ├── test-java-le-11 │ └── java │ │ └── org │ │ └── spockframework │ │ └── smoke │ │ └── mock │ │ ├── IEither.java │ │ └── IMaybe.java │ └── test │ ├── groovy │ ├── org │ │ └── spockframework │ │ │ ├── EmbeddedSpecification.groovy │ │ │ ├── builder │ │ │ └── PojoBuilderSpec.groovy │ │ │ ├── buildsupport │ │ │ └── SpecClassFileFinderSpec.groovy │ │ │ ├── datapipes │ │ │ └── DataPipesIteratorSpec.groovy │ │ │ ├── docs │ │ │ ├── datadriven │ │ │ │ ├── DataSpec.groovy │ │ │ │ ├── v1 │ │ │ │ │ └── MathSpec.groovy │ │ │ │ ├── v2 │ │ │ │ │ └── MathSpec.groovy │ │ │ │ ├── v3 │ │ │ │ │ └── MathSpec.groovy │ │ │ │ ├── v4 │ │ │ │ │ └── MathSpec.groovy │ │ │ │ ├── v5 │ │ │ │ │ └── MathSpec.groovy │ │ │ │ ├── v6 │ │ │ │ │ └── MathSpec.groovy │ │ │ │ └── v7 │ │ │ │ │ └── MathSpec.groovy │ │ │ ├── extension │ │ │ │ ├── ConfineMetaClassChangesDocSpec.groovy │ │ │ │ ├── ExtensionStoreSpec.groovy │ │ │ │ ├── FancyMockMaker.java │ │ │ │ ├── FancyMockMakerDocSpec.groovy │ │ │ │ ├── IgnoreIfDocSpec.groovy │ │ │ │ ├── InterceptorSpec.groovy │ │ │ │ ├── IssueDocSpec.groovy │ │ │ │ ├── MockMakerConfigurationDocSpec.groovy │ │ │ │ ├── ParameterInjectionSpec.groovy │ │ │ │ ├── PendingFeatureIfDocSpec.groovy │ │ │ │ ├── RequiresDocSpec.groovy │ │ │ │ ├── SeeDocSpec.groovy │ │ │ │ ├── SnapshotDocSpec.groovy │ │ │ │ ├── StepwiseDocSpec.groovy │ │ │ │ ├── SubjectDocSpec.groovy │ │ │ │ ├── TagDocSpec.groovy │ │ │ │ ├── TempDirDocSpec.groovy │ │ │ │ └── UseDocSpec.groovy │ │ │ ├── interaction │ │ │ │ ├── BuilderExampleSpec.groovy │ │ │ │ ├── DetachedMockFactoryDocSpec.groovy │ │ │ │ ├── GlobalMockDocSpec.groovy │ │ │ │ ├── InteractionDocSpec.groovy │ │ │ │ ├── MockMakerDocSpec.groovy │ │ │ │ └── StaticSpyDocSpec.groovy │ │ │ ├── parallel │ │ │ │ └── ParallelConfigDoc.groovy │ │ │ ├── primer │ │ │ │ ├── ConditionsSpec.groovy │ │ │ │ ├── VerifyEachDocSpec.groovy │ │ │ │ └── VerifyMethodsDocSpec.groovy │ │ │ ├── timeout │ │ │ │ └── TimeoutConfigurationDoc.groovy │ │ │ └── utilities │ │ │ │ ├── AgeFilter.java │ │ │ │ ├── CollectionConditions.groovy │ │ │ │ ├── ConditionBlockSpec.groovy │ │ │ │ ├── FileSystemFixtureSpec.groovy │ │ │ │ ├── MutableClockDocSpec.groovy │ │ │ │ └── OldMethodSpec.groovy │ │ │ ├── example │ │ │ └── FeatureUnrolling.groovy │ │ │ ├── groovy │ │ │ ├── AssertStatementSourcePositionTest.groovy │ │ │ ├── DGMMatcherIterator.groovy │ │ │ ├── FieldInitializers.groovy │ │ │ ├── GroovyMopExploration.groovy │ │ │ ├── GroovyVarArgs.groovy │ │ │ ├── PackageNames.groovy │ │ │ ├── ReturnStatementSourcePositionTest.groovy │ │ │ ├── SourcePositionPhaseConversion.groovy │ │ │ ├── SourcePositionPhaseSemanticAnalysis.groovy │ │ │ └── VarArgsSpec.groovy │ │ │ ├── idea │ │ │ └── IntelliJIdeaSpec.groovy │ │ │ ├── mock │ │ │ ├── AccessProtectedPropsSpec.groovy │ │ │ ├── AdditionalInterfaceResponseSpec.groovy │ │ │ ├── AutoAttachInvalidUsageSpec.groovy │ │ │ ├── AutoAttachSpec.groovy │ │ │ ├── DetachedMockFactorySpec.groovy │ │ │ ├── DetachedMockSpec.groovy │ │ │ ├── MockDetectorSpec.groovy │ │ │ ├── MockMapDelegateSpec.groovy │ │ │ ├── MockSpecInfoAnnotationSpec.groovy │ │ │ ├── UnattachedMockSpec.groovy │ │ │ ├── response │ │ │ │ ├── IterableResponseGeneratorSpec.groovy │ │ │ │ └── MockPrimitiveTypeResponsesSpec.groovy │ │ │ └── runtime │ │ │ │ ├── ByteBuddyMockFactoryConcurrentSpec.groovy │ │ │ │ ├── ByteBuddyMockMakerSpec.groovy │ │ │ │ ├── ByteBuddyTestClassLoader.java │ │ │ │ ├── CglibMockMakerSpec.groovy │ │ │ │ ├── JavaMockFactorySpec.groovy │ │ │ │ ├── JavaProxyMockMakerSpec.groovy │ │ │ │ ├── MockConfigurationSpec.groovy │ │ │ │ ├── MockMakerRegistrySpec.groovy │ │ │ │ └── mockito │ │ │ │ ├── AccessProtectedJavaBaseClass.java │ │ │ │ ├── MockitoMockMakerSpec.groovy │ │ │ │ └── MockitoStaticMocksSpec.groovy │ │ │ ├── runtime │ │ │ ├── AsyncRunListenerSpec.groovy │ │ │ ├── BlockListenerSpec.groovy │ │ │ ├── ClosingOfDataProviders.groovy │ │ │ ├── ConfigurationScriptLoaderSpec.groovy │ │ │ ├── DataVariablesIterationNameProviderSpec.groovy │ │ │ ├── ErrorSpecNodeSpec.groovy │ │ │ ├── EstimatedNumberOfIterations.groovy │ │ │ ├── ExtensionClassesLoaderSpec.groovy │ │ │ ├── GlobalExtensionRegistrySpec.groovy │ │ │ ├── GroovyMethods.groovy │ │ │ ├── GroovyRuntimeUtilIsVoidMethodSpec.groovy │ │ │ ├── GroovyRuntimeUtilSpec.groovy │ │ │ ├── NamespacedExtensionStoreSpec.groovy │ │ │ ├── RunContextEmbeddedSpec.groovy │ │ │ ├── RunContextSpec.groovy │ │ │ ├── RunListenerSpec.groovy │ │ │ ├── SafeIterationNameProviderSpec.groovy │ │ │ ├── SpecUtilSpec.groovy │ │ │ ├── StandardStreamsCapturerSpec.groovy │ │ │ ├── StoreSpec.groovy │ │ │ ├── condition │ │ │ │ ├── EditDistanceSpec.groovy │ │ │ │ └── EditPathRendererSpec.groovy │ │ │ ├── extension │ │ │ │ ├── AnnotationDrivenExtensionSpec.groovy │ │ │ │ └── builtin │ │ │ │ │ ├── ThreadDumpUtilityTypeTest.groovy │ │ │ │ │ └── UnrollIterationNameProviderSpec.groovy │ │ │ └── model │ │ │ │ ├── IterationFilterSpec.groovy │ │ │ │ ├── SpecInfoHierarchySpec.groovy │ │ │ │ ├── SpecInfoSpec.groovy │ │ │ │ └── TestTagTest.groovy │ │ │ ├── serialization │ │ │ └── ErrorSerializationTest.groovy │ │ │ ├── smoke │ │ │ ├── AccessingOldValues.groovy │ │ │ ├── AnonymousInnerClasses.groovy │ │ │ ├── AssertionErrorMessages.groovy │ │ │ ├── Blocks.groovy │ │ │ ├── BuiltInMembersOfClassSpecification.groovy │ │ │ ├── CleanupBlocks.groovy │ │ │ ├── CompileTimeErrorReporting.groovy │ │ │ ├── DisambiguationInConditions.groovy │ │ │ ├── DisambiguationInConditionsTestee.java │ │ │ ├── ExpectBlocks.groovy │ │ │ ├── FeatureFiltering.groovy │ │ │ ├── FeatureMethods.groovy │ │ │ ├── FinalFields.groovy │ │ │ ├── FixtureMethods.groovy │ │ │ ├── GroovyCallChain.groovy │ │ │ ├── InteractionsAndExceptionConditions.groovy │ │ │ ├── Interceptors.groovy │ │ │ ├── MethodAccessibility.groovy │ │ │ ├── MethodExecutionOrder.groovy │ │ │ ├── MisspelledFixtureMethods.groovy │ │ │ ├── MixingExpectAndWhenThenBlocks.groovy │ │ │ ├── NameClashes.groovy │ │ │ ├── RecorderScope.groovy │ │ │ ├── SetupBlocks.groovy │ │ │ ├── SharedFields.groovy │ │ │ ├── SharedFieldsInSuperclass.groovy │ │ │ ├── SharedVsStaticFields.groovy │ │ │ ├── SpecFields.groovy │ │ │ ├── SpecInheritance.groovy │ │ │ ├── SpecRecognition.groovy │ │ │ ├── SpecWithoutFeatures.groovy │ │ │ ├── StackTraceFiltering.groovy │ │ │ ├── StaticMethodsInSpecifications.groovy │ │ │ ├── StaticTypeChecking.groovy │ │ │ ├── VerifyAllMethodsSpecification.groovy │ │ │ ├── VerifyEachBlocks.groovy │ │ │ ├── VerifyMethodsSpecification.groovy │ │ │ ├── VoidGroovyStaticMethod.groovy │ │ │ ├── VoidMethodCallsInExpectBlocks.groovy │ │ │ ├── VoidMethodCallsInThenBlocks.groovy │ │ │ ├── WhenThenBlocks.groovy │ │ │ ├── WithBlockFailingConditions.groovy │ │ │ ├── WithBlockPassingConditions.groovy │ │ │ ├── WithBlocks.groovy │ │ │ ├── WithBlocksStatic.groovy │ │ │ ├── ast │ │ │ │ ├── AstSpec.groovy │ │ │ │ ├── BlocksAst.groovy │ │ │ │ ├── CleanupBlocksAstSpec.groovy │ │ │ │ ├── DataAstSpec.groovy │ │ │ │ ├── DataTablesAstSpec.groovy │ │ │ │ ├── condition │ │ │ │ │ ├── BaseVerifyMethodsAstSpec.groovy │ │ │ │ │ ├── CollectionConditionAstSpec.groovy │ │ │ │ │ ├── ConditionMethodsAstSpec.groovy │ │ │ │ │ ├── ExceptionConditionsAstSpec.groovy │ │ │ │ │ ├── VerifyAllMethodsAstSpec.groovy │ │ │ │ │ └── VerifyMethodsAstSpec.groovy │ │ │ │ └── mock │ │ │ │ │ └── MocksAstSpec.groovy │ │ │ ├── condition │ │ │ │ ├── ArrayComparisonRendering.groovy │ │ │ │ ├── CollectionConditionRendering.groovy │ │ │ │ ├── ConditionEvaluation.groovy │ │ │ │ ├── ConditionNotSatisfiedErrors.groovy │ │ │ │ ├── ConditionRendering.groovy │ │ │ │ ├── ConditionRenderingSpec.groovy │ │ │ │ ├── ConditionsAndGroovyTruth.groovy │ │ │ │ ├── DiffedObjectRendering.groovy │ │ │ │ ├── EqualityComparisonRendering.groovy │ │ │ │ ├── ExceptionConditions.groovy │ │ │ │ ├── ExceptionsInConditions.groovy │ │ │ │ ├── ExplicitConditionsInFeatureMethods.groovy │ │ │ │ ├── ExplicitConditionsInFields.groovy │ │ │ │ ├── ExplicitConditionsInFixtureMethods.groovy │ │ │ │ ├── ExplicitConditionsInHelperMethods.groovy │ │ │ │ ├── ExplicitConditionsInNestedPositions.groovy │ │ │ │ ├── ExplicitConditionsWithMessage.groovy │ │ │ │ ├── ImplicitClosureCallRendering.groovy │ │ │ │ ├── InvalidConditions.groovy │ │ │ │ ├── IsRenderedExtension.groovy │ │ │ │ ├── MatcherConditionRendering.groovy │ │ │ │ ├── MatcherConditions.groovy │ │ │ │ ├── MethodConditionEvaluation.groovy │ │ │ │ ├── NegativeExceptionConditions.groovy │ │ │ │ ├── PartialConditionEvaluation.groovy │ │ │ │ ├── SetComparisonRendering.groovy │ │ │ │ ├── StringComparisonRendering.groovy │ │ │ │ └── ValueRendering.groovy │ │ │ ├── extension │ │ │ │ ├── AutoCleanupExtension.groovy │ │ │ │ ├── ConditionallyIgnoreFeature.groovy │ │ │ │ ├── FailsWithExtension.groovy │ │ │ │ ├── Fast.groovy │ │ │ │ ├── GlobalTimeoutExtension.groovy │ │ │ │ ├── IgnoreExtension.groovy │ │ │ │ ├── IgnoreIfExtension.groovy │ │ │ │ ├── IgnoreRestExtension.groovy │ │ │ │ ├── ImpliedFeatureSpec.groovy │ │ │ │ ├── IncludeExcludeFeatures.groovy │ │ │ │ ├── IncludeExcludeFeaturesWithInheritance.groovy │ │ │ │ ├── IncludeExcludeSpecs.groovy │ │ │ │ ├── IncludeExcludeSpecsAndFeatures.groovy │ │ │ │ ├── IncludeExcludeSpecsWithInheritance.groovy │ │ │ │ ├── IssueExtension.groovy │ │ │ │ ├── MixedSpecSkippingExtensions.groovy │ │ │ │ ├── NarrativeExtension.groovy │ │ │ │ ├── ParallelSpec.groovy │ │ │ │ ├── PendingFeatureExtensionSpec.groovy │ │ │ │ ├── PendingFeatureIfExtensionSpec.groovy │ │ │ │ ├── RepeatUntilFailureExtensionSpec.groovy │ │ │ │ ├── RepeatableLocalExtensionsSpec.groovy │ │ │ │ ├── RequiresExtension.groovy │ │ │ │ ├── RestoreSystemPropertiesExtension.groovy │ │ │ │ ├── RetryFeatureExtensionSpec.groovy │ │ │ │ ├── SeeExtension.groovy │ │ │ │ ├── Slow.groovy │ │ │ │ ├── SnapshotterSpec.groovy │ │ │ │ ├── StepwiseFeatures.groovy │ │ │ │ ├── StepwiseSpecs.groovy │ │ │ │ ├── StepwiseSpecsAndFeatures.groovy │ │ │ │ ├── TagExtension.groovy │ │ │ │ ├── TempDirExtensionSpec.groovy │ │ │ │ ├── TimeoutExtension.groovy │ │ │ │ └── TitleExtension.groovy │ │ │ ├── issues │ │ │ │ └── StackFrameReproducer.groovy │ │ │ ├── mock │ │ │ │ ├── AdditionalInterfaces.groovy │ │ │ │ ├── ArgumentCapturing.groovy │ │ │ │ ├── ArgumentMatching.groovy │ │ │ │ ├── ChainedResponseGenerators.groovy │ │ │ │ ├── CompletableFutureSpec.groovy │ │ │ │ ├── DefaultValueProvider.groovy │ │ │ │ ├── ErrorReporting.groovy │ │ │ │ ├── ExplicitInteractions.groovy │ │ │ │ ├── GenericMockInvocations.groovy │ │ │ │ ├── GlobalInteractions.groovy │ │ │ │ ├── GroovyMockAbstractGlobalClass.groovy │ │ │ │ ├── GroovyMockFinalClass.groovy │ │ │ │ ├── GroovyMockGlobalClass.groovy │ │ │ │ ├── GroovyMocks.groovy │ │ │ │ ├── GroovyMocksForGroovyClasses.groovy │ │ │ │ ├── GroovyMocksForInterfaces.groovy │ │ │ │ ├── GroovySpies.groovy │ │ │ │ ├── GroovySpiesThatAreGlobal.groovy │ │ │ │ ├── InteractionScopes.groovy │ │ │ │ ├── InteractionsReferencingFieldsAndProperties.groovy │ │ │ │ ├── InteractionsWithPropertySyntax.groovy │ │ │ │ ├── InvalidMockCreation.groovy │ │ │ │ ├── InvalidStubInteraction.groovy │ │ │ │ ├── InvokingMocksFromMultipleThreads.groovy │ │ │ │ ├── JavaFinalMocks.groovy │ │ │ │ ├── JavaMocksDefaultBehavior.groovy │ │ │ │ ├── JavaMocksForGroovyClasses.groovy │ │ │ │ ├── JavaSpies.groovy │ │ │ │ ├── JavaStubs.groovy │ │ │ │ ├── MethodMatching.groovy │ │ │ │ ├── MockBasics.groovy │ │ │ │ ├── MockCreationWithClosure.groovy │ │ │ │ ├── MockDefaultResponses.groovy │ │ │ │ ├── MockNames.groovy │ │ │ │ ├── MockProxyCaching.groovy │ │ │ │ ├── MockingAndBridgeMethods.groovy │ │ │ │ ├── MockingClosures.groovy │ │ │ │ ├── MockingMethodsWithNamedParameters.groovy │ │ │ │ ├── MockingMethodsWithVarArgParameters.groovy │ │ │ │ ├── MockingOfVarArgParametersUserContributedSpec.groovy │ │ │ │ ├── MultiThreaded.groovy │ │ │ │ ├── OptionalSpec.groovy │ │ │ │ ├── OrderedInteractions.groovy │ │ │ │ ├── OverlappingInteractions.groovy │ │ │ │ ├── PartialMocking.groovy │ │ │ │ ├── PartialMockingInterfacesWithDefaultMethods.groovy │ │ │ │ ├── ResponseGenerators.groovy │ │ │ │ ├── SpreadWildcardUsage.groovy │ │ │ │ ├── SpyBasics.groovy │ │ │ │ ├── StreamSpec.groovy │ │ │ │ ├── StubBasics.groovy │ │ │ │ ├── StubBuilderSupport.groovy │ │ │ │ ├── StubDefaultResponses.groovy │ │ │ │ ├── StubDefaultResponsesWithGenericMethods.groovy │ │ │ │ ├── TargetMatching.groovy │ │ │ │ ├── TooFewInvocations.groovy │ │ │ │ ├── TooManyInvocations.groovy │ │ │ │ ├── ValidMockCreation.groovy │ │ │ │ ├── ValidMockCreationInDerivedClass.groovy │ │ │ │ └── WildcardUsages.groovy │ │ │ ├── parameterization │ │ │ │ ├── DataProviders.groovy │ │ │ │ ├── DataTables.groovy │ │ │ │ ├── InvalidWhereBlocks.groovy │ │ │ │ ├── MethodParameters.groovy │ │ │ │ ├── ParameterizationScopes.groovy │ │ │ │ ├── Parameterizations.groovy │ │ │ │ ├── ParameterizedFeatureNodeStatuses.groovy │ │ │ │ ├── SqlDataSource.groovy │ │ │ │ ├── UnrolledFeatureMethods.groovy │ │ │ │ └── UprolledFeatureMethods.groovy │ │ │ └── traits │ │ │ │ ├── BasicTraitUsage.groovy │ │ │ │ └── MyTrait.groovy │ │ │ ├── util │ │ │ ├── AbstractMultisetSpec.groovy │ │ │ ├── CollectionUtilSpec.groovy │ │ │ ├── ConsoleUtilSpec.groovy │ │ │ ├── DataVariableMapTest.groovy │ │ │ ├── ExceptionUtilSpec.groovy │ │ │ ├── GenericTypeReflectorUtilSpec.groovy │ │ │ ├── GroovyUtilSpec.groovy │ │ │ ├── HashMultisetSpec.groovy │ │ │ ├── JsonWriterSpec.groovy │ │ │ ├── LinkedHashMultisetSpec.groovy │ │ │ ├── ObjectUtilSpec.groovy │ │ │ ├── ReflectionUtilSpec.groovy │ │ │ ├── SpockReleaseInfoSpec.groovy │ │ │ ├── StringMessagePrintStreamSpec.groovy │ │ │ ├── TeePrintStreamSpec.groovy │ │ │ ├── TextUtilSpec.groovy │ │ │ ├── ThreadSupportSpec.groovy │ │ │ ├── TimeUtilSpec.groovy │ │ │ ├── VersionCheckerSpec.groovy │ │ │ └── VersionNumberSpec.groovy │ │ │ └── verifyall │ │ │ └── VerifyAllSpecification.groovy │ └── spock │ │ ├── config │ │ ├── ConfigSupport.groovy │ │ └── ParallelConfigurationSpec.groovy │ │ ├── mock │ │ ├── MockMakerIdSpec.groovy │ │ └── MockingApiInvalidUsageSpec.groovy │ │ ├── timeout │ │ └── BaseTimeoutExtensionSpecification.groovy │ │ └── util │ │ ├── EmbeddedSpecRunnerClassLoaderSpec.groovy │ │ ├── ExceptionsSpec.groovy │ │ ├── JvmSpec.groovy │ │ ├── OperatingSystemSpec.groovy │ │ ├── concurrent │ │ ├── AsyncConditionsSpec.groovy │ │ ├── BlockingVariableSpec.groovy │ │ ├── BlockingVariablesSpec.groovy │ │ └── PollingConditionsSpec.groovy │ │ ├── matcher │ │ └── IsCloseToSpec.groovy │ │ ├── mop │ │ ├── ConfineMetaClassChangesSpec.groovy │ │ └── UseSpec.groovy │ │ └── time │ │ └── MutableClockSpec.groovy │ ├── java │ └── org │ │ └── spockframework │ │ ├── groovy │ │ └── JavaVarArgs.java │ │ ├── mock │ │ ├── AccessProtectedJavaBaseClass.java │ │ ├── FinalClass.java │ │ ├── FinalClassDefaultValueProvider.java │ │ ├── FinalJavaPerson.java │ │ ├── FinalMethodsJavaPerson.java │ │ ├── InterfaceWithNestedClass.java │ │ └── Issue520Repository.java │ │ ├── runtime │ │ └── JavaMethods.java │ │ └── smoke │ │ ├── CallChainException.java │ │ ├── JavaCallChain.java │ │ └── mock │ │ ├── DiscountedItem.java │ │ ├── DiscountedPublicItem.java │ │ ├── IDeposit.java │ │ ├── IQuarterlyCompoundedDeposit.java │ │ ├── ISquare.java │ │ ├── Item.java │ │ ├── JavaCaller.java │ │ ├── MaybeDefaultValueProvider.java │ │ └── PublicItem.java │ └── resources │ ├── META-INF │ └── services │ │ ├── org.spockframework.mock.runtime.IMockMaker │ │ └── org.spockframework.runtime.extension.IDefaultValueProviderExtension │ ├── org │ └── spockframework │ │ ├── runtime │ │ ├── InvalidConfig.txt │ │ ├── ValidConfig.txt │ │ └── extensionDescriptor │ │ └── smoke │ │ └── extension │ │ └── SampleFile.txt │ └── snapshots │ ├── .editorconfig │ └── org │ └── spockframework │ ├── docs │ ├── extension │ │ └── SnapshotDocSpec │ │ │ ├── custom_matching.txt │ │ │ ├── multi_snapshot-otherId.txt │ │ │ ├── multi_snapshot.txt │ │ │ ├── using_field_based_snapshot.txt │ │ │ └── using_parameter_based_snapshot.txt │ └── primer │ │ └── VerifyEachDocSpec │ │ ├── verifyEach_method.txt │ │ ├── verifyEach_with_index_method.txt │ │ └── verifyEach_with_namer_method.txt │ ├── runtime │ └── StoreSpec │ │ └── store_is_created_and_cleaned_for_each_level.txt │ └── smoke │ ├── Interceptors │ ├── interceptors_are_called_in_the_correct_order_and_with_the_correct_context_information.txt │ └── non_method_interceptors_are_called_even_without_the_respective_method.txt │ ├── VerifyEachBlocks │ ├── rendering_of_the_item_can_be_customized_with_the_namer.txt │ ├── verifyEach_fails_handles_nested_exceptions.txt │ ├── verifyEach_handles_a_single_failed_element_verification.txt │ └── verifyEach_handles_multiple_failed_element_verifications.txt │ ├── ast │ ├── AstSpec │ │ ├── Primitive_types_are_used_in_AST_transformation_Groovy____3.txt │ │ ├── Primitive_types_are_used_in_AST_transformation_Groovy____4.txt │ │ ├── astToSourceFeatureBody_can_render_everything.groovy │ │ ├── astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy │ │ ├── astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy │ │ ├── astToSourceFeatureBody_shows_compile_error_in_source.txt │ │ ├── astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy │ │ ├── enums-groovy4.groovy │ │ ├── enums.groovy │ │ ├── full_feature_exercise.groovy │ │ └── groovy_3_language_features.groovy │ ├── BlocksAst │ │ ├── all_observable_blocks_with_GString_labels.groovy │ │ ├── all_observable_blocks_with_empty_labels.groovy │ │ └── all_observable_blocks_with_labels_and_blocks.groovy │ ├── CleanupBlocksAstSpec │ │ ├── cleanup_rewrite_keeps_correct_method_reference.groovy │ │ └── cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy │ ├── DataAstSpec │ │ ├── multi_parameterization.groovy │ │ └── nested_multi_parameterization.groovy │ ├── DataTablesAstSpec │ │ ├── data_tables_with__separators_can_be_combined-[0].groovy │ │ ├── data_tables_with__separators_can_be_combined-[1].groovy │ │ ├── data_tables_with__separators_can_be_combined-[2].groovy │ │ ├── filter_block_becomes_its_own_method.groovy │ │ └── using_a_variable_in_a_cell_multiple_times_compiles.groovy │ ├── condition │ │ ├── CollectionConditionAstSpec │ │ │ ├── collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy │ │ │ ├── collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy │ │ │ ├── regex_find_conditions_are_transformed_correctly.groovy │ │ │ └── regex_match_conditions_are_transformed_correctly.groovy │ │ ├── ConditionMethodsAstSpec │ │ │ ├── GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy │ │ │ ├── GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy │ │ │ ├── condition_method__conditionMethod-[0].groovy │ │ │ ├── condition_method__conditionMethod-[1].groovy │ │ │ ├── condition_method__conditionMethod-[2].groovy │ │ │ ├── condition_method__conditionMethod_with_exception-[0].groovy │ │ │ ├── condition_method__conditionMethod_with_exception-[1].groovy │ │ │ ├── condition_method__conditionMethod_with_exception-[2].groovy │ │ │ ├── condition_method__conditionMethod_with_only_exception-[0].groovy │ │ │ ├── condition_method__conditionMethod_with_only_exception-[1].groovy │ │ │ ├── condition_method__conditionMethod_with_only_exception-[2].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy │ │ │ ├── condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy │ │ │ └── condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy │ │ ├── ExceptionConditionsAstSpec │ │ │ ├── thrown_rewrite_keeps_correct_method_reference.groovy │ │ │ └── thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy │ │ ├── VerifyAllMethodsAstSpec │ │ │ ├── ignores_conditions_in_overwritten_methods.groovy │ │ │ ├── ignores_methods_without_annotation.groovy │ │ │ ├── methods_without_condition_declarations_stay_unchanged.groovy │ │ │ ├── transforms_conditions_at_all_nesting_levels.groovy │ │ │ ├── transforms_conditions_in_methods_inside_spec_classes.groovy │ │ │ ├── transforms_conditions_in_methods_outside_of_spec_classes.groovy │ │ │ ├── transforms_conditions_in_private_methods.groovy │ │ │ ├── transforms_conditions_in_static_methods.groovy │ │ │ └── transforms_explicit_conditions.groovy │ │ └── VerifyMethodsAstSpec │ │ │ ├── ignores_conditions_in_overwritten_methods.groovy │ │ │ ├── ignores_methods_without_annotation.groovy │ │ │ ├── methods_without_condition_declarations_stay_unchanged.groovy │ │ │ ├── transforms_conditions_at_all_nesting_levels.groovy │ │ │ ├── transforms_conditions_in_methods_inside_spec_classes.groovy │ │ │ ├── transforms_conditions_in_methods_outside_of_spec_classes.groovy │ │ │ ├── transforms_conditions_in_private_methods.groovy │ │ │ ├── transforms_conditions_in_static_methods.groovy │ │ │ └── transforms_explicit_conditions.groovy │ └── mock │ │ └── MocksAstSpec │ │ └── simple_interaction.groovy │ ├── condition │ └── ConditionEvaluation │ │ ├── collection_conditions_work_with_nulls-[0].txt │ │ ├── collection_conditions_work_with_nulls-[1].txt │ │ ├── collection_conditions_work_with_nulls-[2].txt │ │ ├── collection_conditions_work_with_nulls-[3].txt │ │ ├── strict_collection_conditions_work_with_nulls-[0].txt │ │ ├── strict_collection_conditions_work_with_nulls-[1].txt │ │ ├── strict_collection_conditions_work_with_nulls-[2].txt │ │ └── strict_collection_conditions_work_with_nulls-[3].txt │ └── parameterization │ ├── DataProviders │ ├── data_provider_with_asserting_closure_produces_error_rethrower_variable_in_data_provider_method.groovy │ └── data_variable_with_asserting_closure_produces_error_rethrower_variable_in_data_processor_method.groovy │ ├── DataTables │ └── filtered_iterations_are_logged.txt │ └── InvalidWhereBlocks │ ├── using_combined_label_between_data_pipe_and_derived_data_variable_is_not_allowed.txt │ ├── using_combined_label_between_data_pipe_and_derived_data_variable_is_not_allowed_even_with_separator.txt │ ├── using_combined_label_between_data_pipe_and_derived_data_variable_is_not_allowed_even_with_separator_in_front.txt │ ├── using_combined_label_between_data_table_and_derived_data_variable_is_not_allowed.txt │ ├── using_combined_label_between_derived_data_variable_and_data_pipe_is_not_allowed.txt │ ├── using_combined_label_between_derived_data_variable_and_data_pipe_is_not_allowed_even_with_separator.txt │ ├── using_combined_label_between_derived_data_variable_and_data_pipe_is_not_allowed_even_with_separator_in_front.txt │ ├── using_combined_label_between_derived_data_variable_and_data_table_is_not_allowed.txt │ ├── using_combined_label_outside_where_block_is_not_allowed.txt │ ├── using_combined_label_within_semicolon_data_table_row_is_not_allowed.txt │ └── using_filter_label_before_where_block_is_not_allowed.txt ├── spock-spring ├── boot2-test │ ├── boot2-test.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── spockframework │ │ │ │ └── boot2 │ │ │ │ ├── SimpleBootApp.java │ │ │ │ ├── jpa │ │ │ │ ├── Book.java │ │ │ │ └── BookRepository.java │ │ │ │ ├── service │ │ │ │ ├── HelloWorldService.java │ │ │ │ └── ScopedHelloWorldService.java │ │ │ │ └── web │ │ │ │ └── HelloWorldController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── boot2 │ │ ├── DataJpaTestIntegrationSpec.groovy │ │ ├── SimpleBootAppIntegrationSpec.groovy │ │ ├── SpringBeanIntegrationSpec.groovy │ │ ├── SpringBootTestAnnotationIntegrationSpec.groovy │ │ ├── SpringBootTestAnnotationScopedMockSpec.groovy │ │ ├── SpringBootTestAnnotationScopedProxyMockSpec.groovy │ │ └── WebMvcTestIntegrationSpec.groovy ├── boot3-test │ ├── boot3-test.gradle │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── spockframework │ │ │ │ └── boot3 │ │ │ │ ├── SimpleBootApp.java │ │ │ │ ├── jpa │ │ │ │ ├── Book.java │ │ │ │ └── BookRepository.java │ │ │ │ ├── service │ │ │ │ ├── HelloWorldService.java │ │ │ │ └── ScopedHelloWorldService.java │ │ │ │ └── web │ │ │ │ └── HelloWorldController.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── boot3 │ │ ├── DataJpaTestIntegrationSpec.groovy │ │ ├── SimpleBootAppIntegrationSpec.groovy │ │ ├── SpringBeanIntegrationSpec.groovy │ │ ├── SpringBootTestAnnotationIntegrationSpec.groovy │ │ ├── SpringBootTestAnnotationScopedMockSpec.groovy │ │ ├── SpringBootTestAnnotationScopedProxyMockSpec.groovy │ │ └── WebMvcTestIntegrationSpec.groovy ├── spring.gradle ├── spring3-test │ ├── spring3-test.gradle │ └── src │ │ └── test │ │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── spring3 │ │ ├── RuntimeCompatibilitySpec.groovy │ │ └── TestConfig.groovy ├── spring5-test │ ├── spring5-test.gradle │ └── src │ │ └── test │ │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── spring5 │ │ ├── NoMockConfig.groovy │ │ ├── RuntimeCompatibilitySpec.groovy │ │ ├── SpringBeanTest.groovy │ │ ├── SpringRunnerTest.java │ │ └── TestConfig.groovy ├── spring6-test │ ├── spring6-test.gradle │ └── src │ │ └── test │ │ └── groovy │ │ └── org │ │ └── spockframework │ │ └── spring6 │ │ ├── NoMockConfig.groovy │ │ ├── RuntimeCompatibilitySpec.groovy │ │ ├── SpringBeanTest.groovy │ │ ├── SpringRunnerTest.java │ │ └── TestConfig.groovy └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── spockframework │ │ │ └── spring │ │ │ ├── AbstractSpringTestExecutionListener.java │ │ │ ├── EnableSharedInjection.java │ │ │ ├── ScanScopedBeans.java │ │ │ ├── SpringBean.java │ │ │ ├── SpringExtension.java │ │ │ ├── SpringExtensionException.java │ │ │ ├── SpringInterceptor.java │ │ │ ├── SpringMockTestExecutionListener.java │ │ │ ├── SpringSpy.java │ │ │ ├── SpringTestContext.java │ │ │ ├── SpringTestContextManager.java │ │ │ ├── StubBeans.java │ │ │ ├── UnwrapAopProxy.java │ │ │ ├── UnwrapAopProxyExtension.java │ │ │ ├── mock │ │ │ ├── BackwardsCompatibleInstantiationAwareBeanPostProcessorAdapter.java │ │ │ ├── Definition.java │ │ │ ├── DefinitionsParser.java │ │ │ ├── DelegatingInterceptor.java │ │ │ ├── FieldDefinition.java │ │ │ ├── MockDefinition.java │ │ │ ├── QualifierDefinition.java │ │ │ ├── SpockContextCustomizer.java │ │ │ ├── SpockContextCustomizerFactory.java │ │ │ ├── SpockDefinition.java │ │ │ ├── SpockMockPostprocessor.java │ │ │ ├── SpockSpringProxyCreator.java │ │ │ ├── SpyDefinition.java │ │ │ ├── StubDefinition.java │ │ │ └── package-info.java │ │ │ └── xml │ │ │ ├── MockBeanDefinitionParser.java │ │ │ ├── SpockMockFactoryBean.java │ │ │ ├── SpockNamespaceHandler.java │ │ │ ├── SpockSpyBeanPostProcessor.java │ │ │ └── WrapWithSpyBeanDefinitionParser.java │ └── resources │ │ ├── META-INF │ │ ├── services │ │ │ └── org.spockframework.runtime.extension.IGlobalExtension │ │ ├── spring.factories │ │ ├── spring.handlers │ │ └── spring.schemas │ │ └── org │ │ └── spockframework │ │ └── spock.xsd │ └── test │ ├── groovy │ └── org │ │ └── spockframework │ │ └── spring │ │ ├── AlwaysThrowScope.java │ │ ├── ContextHierarchyExample.groovy │ │ ├── DirtiesContextExample.groovy │ │ ├── ErrorHandling.groovy │ │ ├── IService1.groovy │ │ ├── IService2.groovy │ │ ├── InjectionExamples.groovy │ │ ├── LazyBeans.groovy │ │ ├── MockInjectionExample.groovy │ │ ├── MockInjectionWithEmbeddedConfig.groovy │ │ ├── ScopedBeans.groovy │ │ ├── Service1.groovy │ │ ├── Service2.groovy │ │ ├── SharedFieldsInjection.groovy │ │ ├── SpringSpecInheritance.groovy │ │ ├── TransactionalExample.groovy │ │ ├── TransactionalGroovySqlExample.groovy │ │ ├── docs │ │ ├── DetachedJavaConfig.groovy │ │ ├── GreeterService.groovy │ │ ├── GreeterServiceImpl.groovy │ │ ├── MockExamples.groovy │ │ ├── SpringBeanExamples.groovy │ │ ├── SpringSpyExamples.groovy │ │ └── StubBeansExamples.groovy │ │ └── mock │ │ ├── ComplexUsageSpec.groovy │ │ ├── DemoMockContext.groovy │ │ ├── InvalidUsageSpec.groovy │ │ ├── SpringBeanSpec.groovy │ │ ├── SpringBeanWIthSinglePrimaryBeanSpec.groovy │ │ ├── SpringBeanWithManyOrNoPrimarySpec.groovy │ │ ├── SpringBeansWithExceptionsSpec.groovy │ │ ├── SpringSpyDirtiesContextSpec.groovy │ │ ├── SpringSpyForCircularBeansSpec.groovy │ │ ├── SpringSpySpec.groovy │ │ ├── SpyMockContext.groovy │ │ ├── StubBeansOverrideSpec.groovy │ │ └── imported │ │ ├── SpringBeanOnTestFieldForExistingBeanCacheIntegrationSpec.groovy │ │ ├── SpringBeanOnTestFieldForExistingBeanConfig.groovy │ │ ├── SpringBeanOnTestFieldForExistingBeanIntegrationSpec.groovy │ │ ├── SpringBeanOnTestFieldForExistingBeanWithQualifierIntegrationSpec.groovy │ │ ├── SpringBeanOnTestFieldForNewBeanIntegrationSpec.groovy │ │ ├── SpringBeanWithAopProxySpec.groovy │ │ ├── SpringBeanWithAsyncInterfaceMethodIntegrationSpec.groovy │ │ ├── SpringBeanWithGenericsOnTestFieldForNewBeanIntegrationSpec.groovy │ │ ├── SpringBeanWithInjectedFieldIntegrationSpec.groovy │ │ ├── SpringSpyOnTestFieldForExistingBeanCacheIntegrationTests.groovy │ │ ├── SpringSpyOnTestFieldForExistingBeanConfig.groovy │ │ ├── SpringSpyOnTestFieldForExistingBeanIntegrationTests.groovy │ │ ├── SpringSpyOnTestFieldForExistingGenericBeanIntegrationTests.groovy │ │ ├── SpringSpyOnTestFieldForMultipleExistingBeansWithOnePrimaryIntegrationTests.groovy │ │ ├── SpringSpyWithAopProxyTests.groovy │ │ ├── SpringSpyWithNameOnTestFieldForMultipleExistingBeansTests.groovy │ │ └── SpyBeanWithAopProxyAndNotProxyTargetAwareTests.groovy │ ├── java │ └── org │ │ └── spockframework │ │ └── spring │ │ └── mock │ │ └── imported │ │ └── example │ │ ├── CustomQualifier.java │ │ ├── CustomQualifierExampleService.java │ │ ├── DeclaredException.java │ │ ├── ExampleExtraInterface.java │ │ ├── ExampleGenericService.java │ │ ├── ExampleGenericServiceCaller.java │ │ ├── ExampleGenericStringServiceCaller.java │ │ ├── ExampleService.java │ │ ├── ExampleServiceCaller.java │ │ ├── FailingExampleService.java │ │ ├── RealExampleService.java │ │ ├── ServiceWithDeclaredException.java │ │ ├── SimpleExampleIntegerGenericService.java │ │ ├── SimpleExampleService.java │ │ ├── SimpleExampleStringGenericService.java │ │ └── UndeclaredException.java │ └── resources │ ├── log4j.properties │ └── org │ └── spockframework │ └── spring │ ├── InjectionExamples-context.xml │ ├── MockExamples-context.xml │ ├── ScopedBeansMock-context.xml │ ├── ScopedBeansThrowing-context.xml │ ├── TransactionalExample-context.xml │ ├── TransactionalGroovySqlExample-context.xml │ └── docs │ └── MockDocu-context.xml ├── spock-tapestry ├── src │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── spockframework │ │ │ │ └── tapestry │ │ │ │ ├── ExtensionModule.java │ │ │ │ ├── SpockTapestry.java │ │ │ │ ├── TapestryExtension.java │ │ │ │ └── TapestryInterceptor.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── org.spockframework.runtime.extension.IGlobalExtension │ └── test │ │ ├── groovy │ │ └── org │ │ │ └── spockframework │ │ │ └── tapestry │ │ │ ├── BeforeRegistryCreatedMethod.groovy │ │ │ ├── InjectionExamples.groovy │ │ │ ├── InjectionExamplesWithImportModule.groovy │ │ │ └── TapestrySpecInheritance.groovy │ │ └── java │ │ └── org │ │ └── spockframework │ │ └── tapestry │ │ ├── IService1.java │ │ ├── IService2.java │ │ ├── IService3.java │ │ ├── Module1.java │ │ ├── Module2.java │ │ ├── Service1.java │ │ ├── Service2.java │ │ └── Service3.java └── tapestry.gradle ├── spock-testkit ├── src │ └── test │ │ └── groovy │ │ └── spock │ │ ├── platform │ │ ├── DontSwallowErrorTest.java │ │ ├── InheritedTest.java │ │ ├── SpockEngineBase.java │ │ ├── SpockHelloWorldTest.java │ │ └── TagCompatibilityTest.groovy │ │ └── testkit │ │ ├── oom │ │ └── OomSpec.groovy │ │ └── testsources │ │ ├── ChildTagSpec.groovy │ │ ├── CleanupTestCase.groovy │ │ ├── ErrorTestCase.groovy │ │ ├── ExampleTestCase.groovy │ │ ├── InheritedChildTestCase.groovy │ │ ├── InheritedParentTestCase.groovy │ │ ├── SetupCleanupTestCase.groovy │ │ ├── SharedSetupCleanupTestCase.groovy │ │ ├── SimpleTagSpec.groovy │ │ ├── StepwiseTestCase.groovy │ │ └── UnrollTestCase.groovy └── testkit.gradle └── spock-unitils ├── src ├── main │ └── java │ │ ├── org │ │ └── spockframework │ │ │ └── unitils │ │ │ ├── UnitilsExtension.java │ │ │ └── UnitilsInterceptor.java │ │ └── spock │ │ └── unitils │ │ ├── UnitilsSupport.java │ │ └── package-info.java └── test │ ├── groovy │ └── org │ │ └── spockframework │ │ └── unitils │ │ └── dbunit │ │ ├── User.groovy │ │ ├── UserDao.groovy │ │ └── UserDaoSpec.groovy │ ├── java │ └── org │ │ └── unitils │ │ └── core │ │ └── dbsupport │ │ └── H2DbSupport.java │ └── resources │ ├── org │ └── spockframework │ │ └── unitils │ │ └── dbunit │ │ └── UserDaoSpec.xml │ └── unitils.properties └── unitils.gradle /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.{java,groovy,gradle,xml,html,js}] 10 | indent_style = space 11 | indent_size = 2 12 | 13 | [**/StringComparisonRendering.groovy] 14 | # The file contains important whitespace at the end of the line in a multi-line string. 15 | # and editorconfig doesn't seem to respect multi-line strings. 16 | trim_trailing_whitespace = false 17 | 18 | [*.{kt,kts}] 19 | indent_size = 4 20 | ij_kotlin_allow_trailing_comma = false 21 | ij_kotlin_allow_trailing_comma_on_call_site = false 22 | ktlint_code_style = intellij_idea 23 | ktlint_standard_function-signature = disabled 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Spock Gitter Chat 4 | url: https://gitter.im/spockframework/spock 5 | about: Come here to chat, hang out, and ask smaller questions 6 | - name: Stack Overflow 7 | url: https://stackoverflow.com/questions/tagged/spock 8 | about: For questions of the type "why isn't this working" 9 | - name: Spock GitHub Discussions 10 | url: https://github.com/spockframework/spock/discussions 11 | about: For other questions and discussions 12 | -------------------------------------------------------------------------------- /.github/actions/setup-build-env/action.yml: -------------------------------------------------------------------------------- 1 | name: Setup Gradle and JDKs 2 | description: Sets up Gradle and JDKs 3 | inputs: 4 | additional-java-version: 5 | required: false 6 | description: Additional Java version to install 7 | default: '8' 8 | 9 | runs: 10 | using: "composite" 11 | steps: 12 | - name: 'Set up JDKs' 13 | uses: ./.github/actions/setup-jdks 14 | with: 15 | additional-java-version: ${{ inputs.additional-java-version }} 16 | - name: Init Gradle Build Action 17 | uses: gradle/actions/setup-gradle@v4 18 | with: 19 | cache-read-only: ${{ github.ref != 'refs/heads/master' }} 20 | - name: 'Gradle javaToolchains' 21 | run: ./gradlew --show-version javaToolchains 22 | shell: bash 23 | -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | max_report_age: off 3 | 4 | comment: 5 | layout: "reach, diff, flags, files" 6 | after_n_builds: 18 7 | -------------------------------------------------------------------------------- /.idea/copyright/ASLv2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spockframework/spock/a88b966bed0f9073f6e32d2f4fd0ca186ec54388/.idea/icon.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Spock distribution. == 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | The Apache Software Foundation (https://www.apache.org/). 9 | 10 | For licenses see the LICENSE file. 11 | 12 | If any software distributed with Spock does not have an Apache 2 License, its license is explicitly listed in the 13 | LICENSE file. 14 | -------------------------------------------------------------------------------- /allVariants: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | for var in 2.5 3.0 4.0; do 3 | ./gradlew -Dvariant="$var" "$@" 4 | done 5 | -------------------------------------------------------------------------------- /allVariants.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | for %%v in (2.5 3.0 4.0) do ( 3 | gradlew.bat -Dvariant=%%v %* 4 | ) 5 | -------------------------------------------------------------------------------- /build-logic/asciidoc-extensions/asciidoc-extensions.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java-library' 3 | id 'idea' 4 | } 5 | 6 | dependencies { 7 | compileOnly libs.asciidoctorj 8 | } 9 | 10 | java { 11 | toolchain { 12 | // IntelliJ currently doesn't support running classes compiled with Java 21 in its preview viewer 13 | languageVersion = JavaLanguageVersion.of(17) 14 | } 15 | } 16 | 17 | tasks.register('installAsciidocExtension', Copy) { 18 | from(tasks.named('jar')) 19 | into('../../.asciidoctor/lib') 20 | } 21 | 22 | tasks.named('ideaModule') { 23 | it.dependsOn('installAsciidocExtension') 24 | } 25 | -------------------------------------------------------------------------------- /build-logic/asciidoc-extensions/src/main/java/org/spockframework/plugins/asciidoctor/SpockExtension.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.plugins.asciidoctor; 2 | 3 | import org.asciidoctor.Asciidoctor; 4 | import org.asciidoctor.jruby.extension.spi.ExtensionRegistry; 5 | 6 | public class SpockExtension implements ExtensionRegistry { 7 | 8 | @Override 9 | public void register(Asciidoctor asciidoctor) { 10 | var registry = asciidoctor.javaExtensionRegistry(); 11 | registry.inlineMacro(SpockIssueInlineMacroProcessor.class); 12 | registry.inlineMacro(SpockPullInlineMacroProcessor.class); 13 | new IncludedSourceLinker().register(registry); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /build-logic/asciidoc-extensions/src/main/java/org/spockframework/plugins/asciidoctor/SpockIssueInlineMacroProcessor.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.plugins.asciidoctor; 2 | 3 | import org.asciidoctor.ast.ContentNode; 4 | import org.asciidoctor.ast.PhraseNode; 5 | import org.asciidoctor.ast.StructuralNode; 6 | import org.asciidoctor.extension.InlineMacroProcessor; 7 | import org.asciidoctor.extension.Name; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | @Name("spockIssue") 13 | public class SpockIssueInlineMacroProcessor extends InlineMacroProcessor { 14 | 15 | @Override 16 | public PhraseNode process(StructuralNode parent, String target, Map attributes) { 17 | 18 | String href = parent.getDocument().getAttribute("github-base") + "/issues/" + target; 19 | 20 | Map options = new HashMap<>(); 21 | options.put("type", ":link"); 22 | options.put("target", href); 23 | return createPhraseNode(parent, "anchor", "#" + target, attributes, options); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /build-logic/asciidoc-extensions/src/main/java/org/spockframework/plugins/asciidoctor/SpockPullInlineMacroProcessor.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.plugins.asciidoctor; 2 | 3 | import org.asciidoctor.ast.ContentNode; 4 | import org.asciidoctor.ast.PhraseNode; 5 | import org.asciidoctor.ast.StructuralNode; 6 | import org.asciidoctor.extension.InlineMacroProcessor; 7 | import org.asciidoctor.extension.Name; 8 | 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | @Name("spockPull") 13 | public class SpockPullInlineMacroProcessor extends InlineMacroProcessor { 14 | 15 | @Override 16 | public PhraseNode process(StructuralNode parent, String target, Map attributes) { 17 | 18 | String href = parent.getDocument().getAttribute("github-base") + "/pull/" + target; 19 | 20 | Map options = new HashMap<>(); 21 | options.put("type", ":link"); 22 | options.put("target", href); 23 | return createPhraseNode(parent, "anchor", "#" + target, attributes, options); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /build-logic/asciidoc-extensions/src/main/resources/META-INF/services/org.asciidoctor.jruby.extension.spi.ExtensionRegistry: -------------------------------------------------------------------------------- 1 | org.spockframework.plugins.asciidoctor.SpockExtension 2 | -------------------------------------------------------------------------------- /build-logic/base/base.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy-gradle-plugin' 3 | id 'idea' 4 | } 5 | 6 | gradlePlugin { 7 | plugins { 8 | spockBasePlugin { 9 | id = 'org.spockframework.base' 10 | implementationClass = 'org.spockframework.gradle.SpockBasePlugin' 11 | } 12 | } 13 | } 14 | 15 | dependencies { 16 | implementation('org.ccil.cowan.tagsoup:tagsoup:1.2.1') 17 | } 18 | 19 | testing { 20 | suites { 21 | test { 22 | useSpock('2.4-M6-groovy-3.0') 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /build-logic/build-logic.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | group = 'spockbuild' 3 | } 4 | -------------------------------------------------------------------------------- /build-logic/preprocess-workflows/preprocess-workflows.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'groovy-gradle-plugin' 3 | id 'idea' 4 | } 5 | 6 | dependencies { 7 | compileOnly(libs.workflows.kotlin.compilerEmbeddable) 8 | } 9 | 10 | gradlePlugin { 11 | plugins { 12 | preprocessWorkflowsPlugin { 13 | id = 'org.spockframework.preprocess-workflows' 14 | implementationClass = 'org.spockframework.gradle.PreprocessWorkflowsPlugin' 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /build-logic/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenCentral() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | rootProject.name = "build-logic" 9 | rootProject.buildFileName = 'build-logic.gradle' 10 | 11 | dependencyResolutionManagement { 12 | versionCatalogs { 13 | create("libs") { 14 | from(files("../gradle/libs.versions.toml")) 15 | } 16 | } 17 | repositories { 18 | mavenCentral() 19 | } 20 | } 21 | 22 | include("base") 23 | include("preprocess-workflows") 24 | include("asciidoc-extensions") 25 | 26 | nameBuildScriptsAfterProjectNames(rootProject.children) 27 | 28 | def nameBuildScriptsAfterProjectNames(projects) { 29 | for (prj in projects) { 30 | prj.buildFileName = prj.name + ".gradle" 31 | nameBuildScriptsAfterProjectNames(prj.children) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /config/code-signing-secring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spockframework/spock/a88b966bed0f9073f6e32d2f4fd0ca186ec54388/config/code-signing-secring.gpg -------------------------------------------------------------------------------- /config/nohttp/allowlist.lines: -------------------------------------------------------------------------------- 1 | // Unitils website doesn't have https support yet. 2 | ^http://www.unitils.org/?$ 3 | 4 | // SVG 5 | ^http://www.inkscape.org/$ 6 | ^http://purl.org/dc/dcmitype/StillImage$ 7 | 8 | // XMLNS 9 | ^http://www.spockframework.org/spring$ 10 | 11 | // Spring schemas from the Spring library classpath 12 | ^http://www.springframework.org/schema/beans/spring-beans.xsd$ 13 | ^http://www.springframework.org/schema/beans/spring-beans-2.5.xsd$ 14 | -------------------------------------------------------------------------------- /config/nohttp/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/all_in_one.adoc: -------------------------------------------------------------------------------- 1 | = Spock Framework Reference Documentation 2 | :toc: left 3 | :toclevels: 3 4 | include::include.adoc[] 5 | 6 | include::introduction.adoc[leveloffset=+1] 7 | 8 | include::getting_started.adoc[leveloffset=+1] 9 | 10 | include::spock_primer.adoc[leveloffset=+1] 11 | 12 | include::data_driven_testing.adoc[leveloffset=+1] 13 | 14 | include::interaction_based_testing.adoc[leveloffset=+1] 15 | 16 | include::extensions.adoc[leveloffset=+1] 17 | 18 | include::utilities.adoc[leveloffset=+1] 19 | 20 | include::parallel_execution.adoc[leveloffset=+1] 21 | 22 | include::modules.adoc[leveloffset=+1] 23 | 24 | include::release_notes.adoc[leveloffset=+1] 25 | 26 | include::migration_guide.adoc[leveloffset=+1] 27 | 28 | include::faq.adoc[leveloffset=+1] 29 | 30 | include::known_issues.adoc[leveloffset=+1] 31 | -------------------------------------------------------------------------------- /docs/docinfo.html: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /docs/images/Blocks2Phases.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spockframework/spock/a88b966bed0f9073f6e32d2f4fd0ca186ec54388/docs/images/Blocks2Phases.png -------------------------------------------------------------------------------- /docs/images/spock-main-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spockframework/spock/a88b966bed0f9073f6e32d2f4fd0ca186ec54388/docs/images/spock-main-logo.png -------------------------------------------------------------------------------- /docs/images/spock-main-logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/images/spock_interceptors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spockframework/spock/a88b966bed0f9073f6e32d2f4fd0ca186ec54388/docs/images/spock_interceptors.png -------------------------------------------------------------------------------- /docs/index.adoc: -------------------------------------------------------------------------------- 1 | = Spock Framework Reference Documentation 2 | include::include.adoc[] 3 | 4 | . <> 5 | . <> 6 | . <> 7 | . <> 8 | . <> 9 | . <> 10 | . <> 11 | . <> 12 | . <> 13 | . <> 14 | . <> 15 | . <> 16 | . <> 17 | 18 | <> 19 | -------------------------------------------------------------------------------- /docs/introduction.adoc: -------------------------------------------------------------------------------- 1 | = Introduction 2 | include::include.adoc[] 3 | 4 | image::images/spock-main-logo.png[Spock Logo, align=center, width=20%] 5 | 6 | Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd 7 | is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most 8 | IDEs, build tools, and continuous integration servers. Spock is inspired from https://junit.org/[JUnit], 9 | https://www.jmock.org/[jMock], https://rspec.info/[RSpec], https://groovy-lang.org/[Groovy], https://scala-lang.org/[Scala], 10 | https://en.wikipedia.org/wiki/Vulcan_(Star_Trek)[Vulcans], and other fascinating life forms. 11 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2018 the original author or authors. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | org.gradle.java.installations.auto-download=false 18 | org.gradle.java.installations.fromEnv=JDK8,JDK11,JDK17,JDK21,JDK23 19 | 20 | org.gradle.parallel=true 21 | org.gradle.caching=true 22 | 23 | javaVersionsList=8, 11, 17, 21 24 | variantsList=2.5, 3.0, 4.0 25 | kotlin.code.style=official 26 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spockframework/spock/a88b966bed0f9073f6e32d2f4fd0ca186ec54388/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionSha256Sum=61ad310d3c7d3e5da131b76bbf22b5a4c0786e9d892dae8c1658d4b484de3caa 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /javadoc/hamcrest-2.2/package-list: -------------------------------------------------------------------------------- 1 | org.hamcrest 2 | org.hamcrest.beans 3 | org.hamcrest.collection 4 | org.hamcrest.comparator 5 | org.hamcrest.core 6 | org.hamcrest.internal 7 | org.hamcrest.io 8 | org.hamcrest.number 9 | org.hamcrest.object 10 | org.hamcrest.text 11 | org.hamcrest.xml 12 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - sdk install java 8.0.345-tem 3 | - sdk install java 11.0.16-tem 4 | - sdk use java 11.0.16-tem 5 | - export JAVA8=`sdk home java 8.0.345-tem` 6 | - export JAVA11=`sdk home java 11.0.16-tem` 7 | install: 8 | - ./gradlew build publishToMavenLocal -Dvariant=2.5 9 | - ./gradlew build publishToMavenLocal -Dvariant=3.0 10 | - ./gradlew build publishToMavenLocal -Dvariant=4.0 11 | -------------------------------------------------------------------------------- /spock-bom/bom.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id('java-platform') 3 | } 4 | apply from: script('publishMaven') 5 | 6 | (rootProject.subprojects - project).each { 7 | evaluationDependsOn(it.path) 8 | } 9 | 10 | dependencies { 11 | constraints { 12 | def mvnProjects = rootProject.subprojects.findAll { it.plugins.hasPlugin('maven-publish') } // find all published projects 13 | mvnProjects -= project // don't self reference 14 | mvnProjects.each { 15 | api("${it.group}:${it.name}:${it.version}") 16 | } 17 | } 18 | } 19 | 20 | ext.displayName = 'Spock Framework - Bill of Materials' 21 | description = 'This bill of materials provides managed spock dependencies.' 22 | ext.packaging = 'pom' 23 | -------------------------------------------------------------------------------- /spock-core/CoreConsole.groovy: -------------------------------------------------------------------------------- 1 | import spock.lang.* 2 | 3 | class AClass extends Specification { 4 | def "atest"() { 5 | expect: 6 | true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/builder/GestaltBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.builder; 16 | 17 | public class GestaltBuilder { 18 | public void build(IGestalt root) { 19 | new Sculpturer().$form(root); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/builder/IBlueprint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.builder; 16 | 17 | import org.spockframework.util.Nullable; 18 | 19 | public interface IBlueprint { 20 | @Nullable 21 | Object getThisObject(); 22 | 23 | void setDelegate(Object delegate); 24 | 25 | void evaluate(); 26 | } 27 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/builder/ISlot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.builder; 16 | 17 | import java.lang.reflect.Type; 18 | 19 | public interface ISlot { 20 | Type getType(); 21 | void write(Object value); 22 | } 23 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/builder/ISlotFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.builder; 16 | 17 | import java.lang.reflect.Type; 18 | 19 | import org.spockframework.util.Nullable; 20 | 21 | public interface ISlotFactory { 22 | @Nullable ISlot create(Object owner, Type ownerType, String name); 23 | } 24 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/compiler/condition/IVerifyMethodRewriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package org.spockframework.compiler.condition; 15 | 16 | public interface IVerifyMethodRewriter { 17 | 18 | void rewrite(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/lang/SpreadWildcard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.lang; 16 | 17 | public class SpreadWildcard { 18 | public static final SpreadWildcard INSTANCE = new SpreadWildcard(); 19 | 20 | private SpreadWildcard() {} 21 | 22 | @Override 23 | public String toString() { 24 | return "*_"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/IArgumentConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | /** 20 | * A constraint on an invocation argument. 21 | * 22 | * @author Peter Niederwieser 23 | */ 24 | public interface IArgumentConstraint { 25 | boolean isSatisfiedBy(Object arg); 26 | String describeMismatch(Object arg); 27 | } 28 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/IDefaultResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | /** 20 | * A strategy for responding to unexpected method calls. Each 21 | * mock object can have its own strategy. 22 | */ 23 | public interface IDefaultResponse extends IResponseGenerator {} 24 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/IInteractionAware.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | public interface IInteractionAware { 20 | void setInteraction(IMockInteraction interaction); 21 | } 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/IInvocationConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | /** 20 | * 21 | * @author Peter Niederwieser 22 | */ 23 | public interface IInvocationConstraint { 24 | boolean isSatisfiedBy(IMockInvocation invocation); 25 | String describeMismatch(IMockInvocation invocation); 26 | } 27 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/IMockController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | /** 20 | * @author Peter Niederwieser 21 | */ 22 | public interface IMockController { 23 | Object handle(IMockInvocation invocation); 24 | } 25 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/codegen/Target.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock.codegen; 2 | 3 | /** 4 | * Serves as a reference point for method handle based class loading and is makes the containing package 5 | * non-empty so generated classes can be legally defined inside of it. 6 | */ 7 | public class Target { 8 | private Target() { 9 | // never called 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/constraint/PropertyNameConstraint.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock.constraint; 2 | 3 | import org.spockframework.mock.*; 4 | import org.spockframework.runtime.GroovyRuntimeUtil; 5 | 6 | public abstract class PropertyNameConstraint implements IInvocationConstraint { 7 | protected String getPropertyName(IMockInvocation invocation) { 8 | IMockMethod method = invocation.getMethod(); 9 | return GroovyRuntimeUtil.getterMethodToPropertyName( 10 | method.getName(), method.getParameterTypes(), method.getReturnType()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Spock's built-in mocking framework. 19 | */ 20 | package org.spockframework.mock; 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyInvoker.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock.runtime; 2 | 3 | public interface ByteBuddyInvoker { 4 | 5 | Object call(Object[] arguments); 6 | } 7 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMethodInvoker.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock.runtime; 2 | 3 | import org.spockframework.mock.*; 4 | import org.spockframework.util.ExceptionUtil; 5 | import org.spockframework.util.ThreadSafe; 6 | 7 | @ThreadSafe 8 | public class ByteBuddyMethodInvoker implements IResponseGenerator { 9 | 10 | private final ByteBuddyInvoker superCall; 11 | 12 | public ByteBuddyMethodInvoker(ByteBuddyInvoker superCall) { 13 | this.superCall = superCall; 14 | } 15 | 16 | @Override 17 | public Object respond(IMockInvocation invocation) { 18 | if (superCall == null) { 19 | throw new IllegalStateException("Cannot invoke abstract method " + invocation.getMethod()); 20 | } 21 | try { 22 | return superCall.call(invocation.getArguments().toArray()); 23 | } catch (Throwable t) { 24 | // Byte Buddy doesn't wrap exceptions in InvocationTargetException, so no need to unwrap 25 | return ExceptionUtil.sneakyThrow(t); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/runtime/ObjectMethodInvoker.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock.runtime; 2 | 3 | import org.spockframework.mock.*; 4 | import org.spockframework.util.ThreadSafe; 5 | 6 | @ThreadSafe 7 | public class ObjectMethodInvoker implements IResponseGenerator { 8 | 9 | public static final ObjectMethodInvoker INSTANCE = new ObjectMethodInvoker(); 10 | 11 | private ObjectMethodInvoker() { 12 | } 13 | 14 | @Override 15 | public Object respond(IMockInvocation invocation) { 16 | IMockInteraction interaction = DefaultJavaLangObjectInteractions.INSTANCE.match(invocation); 17 | if (interaction != null) { 18 | return interaction.accept(invocation).get(); 19 | } 20 | 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/mock/runtime/SpecificationAttachable.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock.runtime; 2 | 3 | import spock.lang.Specification; 4 | 5 | /** 6 | * The Object implementing this interface can be attached to and 7 | * detached from a {@link Specification}. 8 | * 9 | * @author Leonard Bruenings 10 | */ 11 | public interface SpecificationAttachable { 12 | 13 | /** 14 | * Attaches the mock to a specification. 15 | * 16 | * @param specification specification that this mock object should attached to 17 | */ 18 | void attach(Specification specification); 19 | 20 | /** 21 | * Detaches the mock from its current specification. 22 | */ 23 | void detach(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/report/log/ReportLogConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.report.log; 16 | 17 | import spock.config.ConfigurationObject; 18 | 19 | @ConfigurationObject("report") 20 | public class ReportLogConfiguration { 21 | public String issueNamePrefix = ""; 22 | public String issueUrlPrefix = ""; 23 | } 24 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/ConditionFailedWithExceptionError.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime; 2 | 3 | /** 4 | * Indicates that an Exception was thrown while the condition was evaluated. 5 | * 6 | * @since 1.1 7 | */ 8 | public class ConditionFailedWithExceptionError extends ConditionNotSatisfiedError { 9 | public ConditionFailedWithExceptionError(Condition condition, Throwable cause) { 10 | super(condition, cause); 11 | } 12 | 13 | @Override 14 | public String getMessage() { 15 | return "Condition failed with Exception:\n\n" + getCondition().getRendering(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/DummyStackTraceFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.runtime; 16 | 17 | public class DummyStackTraceFilter implements IStackTraceFilter { 18 | @Override 19 | public void filter(Throwable throwable) {} // do nothing 20 | } 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/ErrorCollector.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime; 2 | 3 | import java.util.List; 4 | import java.util.concurrent.CopyOnWriteArrayList; 5 | 6 | public class ErrorCollector { 7 | private final List throwables = new CopyOnWriteArrayList<>(); 8 | 9 | public void collectOrThrow(T error) throws T { 10 | throwables.add(error); 11 | } 12 | 13 | public static final String VALIDATE_COLLECTED_ERRORS = "validateCollectedErrors"; 14 | 15 | public void validateCollectedErrors() throws Throwable { 16 | switch (throwables.size()) { 17 | case 0: 18 | return; 19 | 20 | case 1: 21 | throw throwables.get(0); 22 | 23 | default: 24 | throw new SpockMultipleFailuresError("", throwables); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/ErrorRethrower.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime; 2 | 3 | public class ErrorRethrower extends ErrorCollector { 4 | public static final ErrorRethrower INSTANCE = new ErrorRethrower(); 5 | 6 | private ErrorRethrower() { 7 | if (INSTANCE != null) { 8 | throw new UnsupportedOperationException(); 9 | } 10 | } 11 | 12 | public void collectOrThrow(T error) throws T { 13 | throw error; 14 | } 15 | 16 | @Override 17 | public void validateCollectedErrors() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/ExpressionComparisonRenderer.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime; 2 | 3 | import org.spockframework.runtime.model.ExpressionInfo; 4 | import org.spockframework.util.Nullable; 5 | 6 | public interface ExpressionComparisonRenderer { 7 | /** 8 | * Renders a comparison expression. 9 | * 10 | * @param expr the expression to be rendered 11 | * @return the rendering or {@code null} if it can't be rendered by this renderer 12 | */ 13 | @Nullable 14 | String render(ExpressionInfo expr); 15 | } 16 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/FailedInstanceOfComparisonRenderer.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime; 2 | 3 | import org.spockframework.runtime.model.ExpressionInfo; 4 | import org.spockframework.util.ObjectUtil; 5 | 6 | public class FailedInstanceOfComparisonRenderer implements ExpressionComparisonRenderer { 7 | @Override 8 | public String render(ExpressionInfo expr) { 9 | if (!(Boolean.FALSE.equals(expr.getValue()))) return null; 10 | if (!expr.isInstanceOfComparison()) return null; 11 | 12 | addTypeHint(expr.getChildren().get(0)); 13 | return "false"; 14 | } 15 | 16 | private void addTypeHint(ExpressionInfo expr) { 17 | if (expr.getRenderedValue() == null) return; 18 | 19 | Class exprType = ObjectUtil.voidAwareGetClass(expr.getValue()); 20 | expr.setRenderedValue(expr.getRenderedValue() + " (" + exprType.getName() + ")"); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/IFeatureFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.runtime; 18 | 19 | import org.spockframework.runtime.model.FeatureInfo; 20 | 21 | /** 22 | * 23 | * @author Peter Niederwieser 24 | */ 25 | public interface IFeatureFilter { 26 | boolean matches(FeatureInfo feature); 27 | } 28 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/IFeatureSortOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.runtime; 18 | 19 | import java.util.Comparator; 20 | 21 | import org.spockframework.runtime.model.FeatureInfo; 22 | 23 | /** 24 | * @author Peter Niederwieser 25 | */ 26 | public interface IFeatureSortOrder extends Comparator {} 27 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/IStackTraceFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.runtime; 18 | 19 | public interface IStackTraceFilter { 20 | void filter(Throwable throwable); 21 | } 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/IStandardStreamsListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.runtime; 18 | 19 | public interface IStandardStreamsListener { 20 | void standardOut(String message); 21 | void standardErr(String message); 22 | } 23 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/SpockException.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime; 2 | 3 | public class SpockException extends RuntimeException { 4 | public SpockException() { 5 | super(); 6 | } 7 | 8 | public SpockException(String message) { 9 | super(message); 10 | } 11 | 12 | public SpockException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public SpockException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/condition/IObjectRenderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.runtime.condition; 16 | 17 | public interface IObjectRenderer { 18 | String render(T object); 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/condition/IObjectRendererService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.runtime.condition; 16 | 17 | public interface IObjectRendererService extends IObjectRenderer { 18 | void addRenderer(Class type, IObjectRenderer renderer); 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/extension/builtin/ExecutionExtension.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.extension.builtin; 2 | 3 | import org.spockframework.runtime.extension.IStatelessAnnotationDrivenExtension; 4 | import org.spockframework.runtime.model.*; 5 | import spock.lang.Execution; 6 | 7 | /** 8 | * @since 2.0 9 | */ 10 | public class ExecutionExtension implements IStatelessAnnotationDrivenExtension { 11 | @Override 12 | public void visitSpecAnnotation(Execution annotation, SpecInfo spec) { 13 | spec.getBottomSpec().setExecutionMode(annotation.value()); 14 | } 15 | 16 | @Override 17 | public void visitFeatureAnnotation(Execution annotation, FeatureInfo feature) { 18 | feature.setExecutionMode(annotation.value()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/extension/builtin/IsolatedExtension.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.extension.builtin; 2 | 3 | import org.spockframework.runtime.extension.IStatelessAnnotationDrivenExtension; 4 | import org.spockframework.runtime.model.SpecInfo; 5 | import org.spockframework.runtime.model.parallel.*; 6 | import spock.lang.Isolated; 7 | 8 | import java.util.List; 9 | 10 | public class IsolatedExtension implements IStatelessAnnotationDrivenExtension { 11 | 12 | private static final ExclusiveResource GLOBAL_LOCK = new ExclusiveResource( 13 | org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_KEY, ResourceAccessMode.READ_WRITE); 14 | 15 | @Override 16 | public void visitSpecAnnotations(List annotations, SpecInfo spec) { 17 | spec.getBottomSpec().addExclusiveResource(GLOBAL_LOCK); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/extension/builtin/PendingFeatureSuccessfulError.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.extension.builtin; 2 | 3 | import org.spockframework.util.Beta; 4 | 5 | /** 6 | * @since 2.0 7 | */ 8 | @Beta 9 | public class PendingFeatureSuccessfulError extends AssertionError { 10 | public PendingFeatureSuccessfulError(String detailMessage) { 11 | super(detailMessage); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/extension/builtin/RetryConditionContext.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.extension.builtin; 2 | 3 | import spock.lang.Specification; 4 | 5 | /** 6 | * The context (delegate) for a {@link spock.lang.Retry} condition. 7 | */ 8 | public class RetryConditionContext { 9 | 10 | private final Object instance; 11 | private final Throwable failure; 12 | 13 | RetryConditionContext(Object instance, Throwable failure) { 14 | this.instance = instance; 15 | this.failure = failure; 16 | } 17 | 18 | /** 19 | * Returns the {@code Throwable} thrown by the feature method. 20 | * 21 | * @return the current failure 22 | */ 23 | public Throwable getFailure() { 24 | return failure; 25 | } 26 | 27 | /** 28 | * Returns the current {@code Specification} instance. 29 | * 30 | * @return the current {@code Specification} instance 31 | */ 32 | public S getInstance() { 33 | return (S) instance; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/extension/builtin/SeeExtension.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.extension.builtin; 2 | 3 | import org.spockframework.runtime.extension.IStatelessAnnotationDrivenExtension; 4 | import org.spockframework.runtime.model.Attachment; 5 | import org.spockframework.runtime.model.FeatureInfo; 6 | import org.spockframework.runtime.model.SpecElementInfo; 7 | import org.spockframework.runtime.model.SpecInfo; 8 | 9 | import spock.lang.See; 10 | 11 | public class SeeExtension implements IStatelessAnnotationDrivenExtension { 12 | @Override 13 | public void visitSpecAnnotation(See see, SpecInfo spec) { 14 | addAttachments(see, spec); 15 | } 16 | 17 | @Override 18 | public void visitFeatureAnnotation(See see, FeatureInfo feature) { 19 | addAttachments(see, feature); 20 | } 21 | 22 | private void addAttachments(See see, SpecElementInfo specElement) { 23 | for (String url : see.value()) { 24 | specElement.addAttachment(new Attachment(url, url)); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/extension/builtin/ThreadDumpUtility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.runtime.extension.builtin; 18 | 19 | import java.nio.file.Path; 20 | import java.util.List; 21 | 22 | public interface ThreadDumpUtility { 23 | 24 | String getName(); 25 | 26 | List getCommand(Path javaHome, long pid); 27 | } 28 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/DataProcessorMetadata.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | import org.spockframework.util.Beta; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * @since 2.0 12 | */ 13 | @Beta 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Target(ElementType.METHOD) 16 | public @interface DataProcessorMetadata { 17 | String DATA_VARIABLES = "dataVariables"; 18 | 19 | String[] dataVariables(); 20 | } 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/DataProviderMetadata.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * @author Peter Niederwieser 7 | */ 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target(ElementType.METHOD) 10 | public @interface DataProviderMetadata { 11 | String LINE = "line"; 12 | String DATA_VARIABLES = "dataVariables"; 13 | String PREVIOUS_DATA_TABLE_VARIABLES = "previousDataTableVariables"; 14 | 15 | int line(); 16 | String[] dataVariables(); 17 | String[] previousDataTableVariables() default { }; 18 | } 19 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/ExecutionResult.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | public enum ExecutionResult { 4 | 5 | /** 6 | * Indicates that the execution of a test or container was 7 | * successful. 8 | */ 9 | SUCCESSFUL, 10 | 11 | /** 12 | * Indicates that the execution of a test or container was 13 | * skipped. 14 | */ 15 | SKIPPED, 16 | 17 | /** 18 | * Indicates that the execution of a test or container was 19 | * aborted (started but not finished). 20 | */ 21 | ABORTED, 22 | 23 | /** 24 | * Indicates that the execution of a test or container failed. 25 | */ 26 | FAILED, 27 | 28 | /** 29 | * Indicates that the execution of a test or container was rejected due to a previous failure. 30 | * No further executions should be triggered when this status is returned. 31 | */ 32 | REJECTED 33 | } 34 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/IExcludable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.runtime.model; 16 | 17 | public interface IExcludable { 18 | boolean isExcluded(); 19 | 20 | void setExcluded(boolean excluded); 21 | } 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/IInterceptable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.runtime.model; 16 | 17 | import org.spockframework.runtime.extension.IMethodInterceptor; 18 | 19 | import java.util.List; 20 | 21 | public interface IInterceptable { 22 | List getInterceptors(); 23 | void addInterceptor(IMethodInterceptor interceptor); 24 | } 25 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/INameable.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | public interface INameable { 4 | String getDisplayName(); 5 | void setDisplayName(String displayName); 6 | } 7 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/IParallelInfo.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | import org.spockframework.runtime.model.parallel.*; 4 | 5 | import java.util.*; 6 | 7 | public interface IParallelInfo { 8 | void addExclusiveResource(ExclusiveResource exclusiveResource); 9 | 10 | Set getExclusiveResources(); 11 | 12 | void setExecutionMode(ExecutionMode executionMode); 13 | 14 | Optional getExecutionMode(); 15 | } 16 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/ITestTaggable.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | import java.util.Set; 4 | 5 | public interface ITestTaggable { 6 | void addTestTag(TestTag tag); 7 | 8 | default void addTestTag(String tagName) { 9 | addTestTag(TestTag.create(tagName)); 10 | } 11 | 12 | Set getTestTags(); 13 | } 14 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/Invoker.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | 4 | @FunctionalInterface 5 | public interface Invoker { 6 | Object invoke(Object target, Object... arguments) throws Throwable; 7 | } 8 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/IterationFilter.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | public class IterationFilter { 7 | 8 | private final Set allowed = new HashSet<>(); 9 | private Mode mode = Mode.EXPLICIT; 10 | 11 | public void allow(int index) { 12 | if (this.mode == Mode.EXPLICIT) { 13 | this.allowed.add(index); 14 | } 15 | } 16 | 17 | public void allowAll() { 18 | this.mode = Mode.ALLOW_ALL; 19 | this.allowed.clear(); 20 | } 21 | 22 | public boolean isAllowed(int index) { 23 | return allowed.isEmpty() || allowed.contains(index); 24 | } 25 | 26 | private enum Mode { 27 | EXPLICIT, ALLOW_ALL 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/NameProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.runtime.model; 16 | 17 | public interface NameProvider { 18 | String getName(T t); 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/parallel/ExecutionMode.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model.parallel; 2 | 3 | import org.spockframework.util.Beta; 4 | 5 | /** 6 | * Supported execution modes for parallel test execution. 7 | * 8 | * @since 2.0 9 | */ 10 | @Beta 11 | public enum ExecutionMode { 12 | 13 | /** 14 | * Force execution in same thread as the parent node. 15 | * 16 | * @see #CONCURRENT 17 | */ 18 | SAME_THREAD, 19 | 20 | /** 21 | * Allow concurrent execution with any other node. 22 | * 23 | * @see #SAME_THREAD 24 | */ 25 | CONCURRENT 26 | } 27 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/runtime/model/parallel/ResourceAccessMode.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model.parallel; 2 | 3 | import org.spockframework.util.Beta; 4 | 5 | @Beta 6 | public enum ResourceAccessMode { 7 | 8 | /** 9 | * Require read and write access to the resource. 10 | */ 11 | READ_WRITE, 12 | 13 | /** 14 | * Require only read access to the resource. 15 | */ 16 | READ 17 | 18 | } 19 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/Beta.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.util; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | 7 | /** 8 | * Indicates that the annotated element, a member of Spock's public API, is in a 9 | * trial phase. Until the element is promoted by removing this annotation, it may still undergo 10 | * incompatible changes. This allows us to incorporate valuable feedback from our users 11 | * before freezing the API for a new feature. In the unlikely event that the element isn't deemed fit for 12 | * purpose, it may be removed completely. Typically, elements are promoted within one or two releases. 13 | */ 14 | @Documented 15 | @Retention(RetentionPolicy.SOURCE) 16 | public @interface Beta {} -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/HashMultiset.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.util; 2 | 3 | import java.util.Collection; 4 | import java.util.HashMap; 5 | 6 | /** 7 | * HashMap based implementation of IMultiset. Iteration order is not guaranteed. 8 | * 9 | * @param the element type of the multiset 10 | */ 11 | public class HashMultiset extends AbstractMultiset { 12 | public HashMultiset() { 13 | super(new HashMap<>()); 14 | } 15 | 16 | public HashMultiset(Collection collection) { 17 | this(); 18 | addAll(collection); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/IFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.util; 18 | 19 | /** 20 | * A function from domain D to co-domain C. 21 | * 22 | * @author Peter Niederwieser 23 | */ 24 | public interface IFunction extends IThrowableFunction { 25 | @Override 26 | C apply(D value); 27 | } 28 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/IMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.util; 16 | 17 | public interface IMatcher { 18 | boolean matches(T node); 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/IStoppable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.util; 16 | 17 | public interface IStoppable { 18 | void stop() throws Exception; 19 | } 20 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/Immutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.util; 16 | 17 | import java.lang.annotation.*; 18 | 19 | @Target(ElementType.TYPE) 20 | @Retention(RetentionPolicy.SOURCE) 21 | public @interface Immutable {} 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/IncompatibleGroovyVersionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.util; 16 | 17 | import org.spockframework.runtime.SpockException; 18 | 19 | public class IncompatibleGroovyVersionException extends SpockException { 20 | public IncompatibleGroovyVersionException(String message) { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/LinkedHashMultiset.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.util; 2 | 3 | import java.util.Collection; 4 | import java.util.LinkedHashMap; 5 | 6 | /** 7 | * LinkedHashMap based implementation of IMultiset. Iteration order follows 8 | * order of first insertion of an element. 9 | * 10 | * @param the element type of the multiset 11 | */ 12 | public class LinkedHashMultiset extends AbstractMultiset { 13 | public LinkedHashMultiset() { 14 | super(new LinkedHashMap<>()); 15 | } 16 | 17 | public LinkedHashMultiset(Collection collection) { 18 | this(); 19 | addAll(collection); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/NotThreadSafe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.util; 16 | 17 | import java.lang.annotation.*; 18 | 19 | @Target(ElementType.TYPE) 20 | @Retention(RetentionPolicy.SOURCE) 21 | public @interface NotThreadSafe {} 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/SpockDocLinks.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.util; 2 | 3 | public enum SpockDocLinks { 4 | SPY_ON_JAVA_17("instance-spy-on-java-17"); 5 | 6 | private static final String SPOCK_DOCS_ROOT = "https://spockframework.org/spock/docs/"; 7 | private static final String ALL_IN_ONE_DOC = "/all_in_one.html"; 8 | private final String anchor; 9 | 10 | SpockDocLinks(String anchor) { 11 | this.anchor = anchor; 12 | } 13 | 14 | public String getAnchor() { 15 | return anchor; 16 | } 17 | 18 | public String getLink() { 19 | return SPOCK_DOCS_ROOT + SpockReleaseInfo.getVersion().toOriginalString(false, true) + ALL_IN_ONE_DOC + "#" + anchor; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/org/spockframework/util/ThreadSafe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.util; 16 | 17 | import java.lang.annotation.*; 18 | 19 | @Target(ElementType.TYPE) 20 | @Retention(RetentionPolicy.SOURCE) 21 | public @interface ThreadSafe {} 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/config/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | /** 16 | * Classes modeling Spock's configuration options. 17 | */ 18 | package spock.config; 19 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/lang/Execution.java: -------------------------------------------------------------------------------- 1 | package spock.lang; 2 | 3 | import org.spockframework.runtime.extension.ExtensionAnnotation; 4 | import org.spockframework.runtime.extension.builtin.ExecutionExtension; 5 | import org.spockframework.runtime.model.parallel.ExecutionMode; 6 | import org.spockframework.util.Beta; 7 | 8 | import java.lang.annotation.*; 9 | 10 | /** 11 | * Allows to set the execution mode. 12 | * 13 | * @since 2.0 14 | */ 15 | @Beta 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target({ElementType.TYPE, ElementType.METHOD}) 18 | @ExtensionAnnotation(ExecutionExtension.class) 19 | public @interface Execution { 20 | 21 | /** 22 | * The required/preferred execution mode. 23 | * 24 | * @see ExecutionMode 25 | */ 26 | ExecutionMode value(); 27 | 28 | /** 29 | * The reason of using a non-default execution mode. 30 | * 31 | * @since 2.4 32 | */ 33 | String reason() default ""; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/lang/Tag.java: -------------------------------------------------------------------------------- 1 | package spock.lang; 2 | 3 | import org.spockframework.runtime.extension.ExtensionAnnotation; 4 | import org.spockframework.runtime.extension.builtin.TagExtension; 5 | 6 | import java.lang.annotation.*; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.TYPE, ElementType.METHOD}) 10 | @ExtensionAnnotation(TagExtension.class) 11 | @Repeatable(Tag.Container.class) 12 | public @interface Tag { 13 | 14 | String value(); 15 | 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target({ElementType.TYPE, ElementType.METHOD}) 18 | @interface Container { 19 | Tag[] value(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/lang/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * The core specification language. 19 | */ 20 | package spock.lang; 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/util/concurrent/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | /** 16 | * Utilities for testing concurrent code. 17 | */ 18 | package spock.util.concurrent; 19 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/util/environment/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | /** 16 | * Utilities for dealing with the test environment. 17 | */ 18 | package spock.util.environment; 19 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/util/matcher/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Utilities for using (Hamcrest) matchers. 19 | */ 20 | package spock.util.matcher; 21 | -------------------------------------------------------------------------------- /spock-core/src/main/java/spock/util/mop/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Utilities related to Groovy meta programming. 19 | */ 20 | package spock.util.mop; 21 | -------------------------------------------------------------------------------- /spock-core/src/main/resources/META-INF/services/org.codehaus.groovy.transform.ASTTransformation: -------------------------------------------------------------------------------- 1 | org.spockframework.compiler.SpockTransform -------------------------------------------------------------------------------- /spock-core/src/main/resources/META-INF/services/org.junit.platform.engine.TestEngine: -------------------------------------------------------------------------------- 1 | org.spockframework.runtime.SpockEngine 2 | -------------------------------------------------------------------------------- /spock-core/src/main/resources/META-INF/services/org.spockframework.mock.runtime.IMockMaker: -------------------------------------------------------------------------------- 1 | org.spockframework.mock.runtime.JavaProxyMockMaker 2 | org.spockframework.mock.runtime.ByteBuddyMockMaker 3 | org.spockframework.mock.runtime.CglibMockMaker 4 | org.spockframework.mock.runtime.mockito.MockitoMockMaker 5 | -------------------------------------------------------------------------------- /spock-core/src/main/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension: -------------------------------------------------------------------------------- 1 | org.spockframework.runtime.extension.builtin.GlobalTimeoutExtension 2 | org.spockframework.runtime.extension.builtin.IncludeExcludeExtension 3 | org.spockframework.runtime.extension.builtin.OptimizeRunOrderExtension 4 | org.spockframework.runtime.extension.builtin.UnrollExtension 5 | -------------------------------------------------------------------------------- /spock-core/src/main/resources/org/spockframework/util/SpockReleaseInfo.properties: -------------------------------------------------------------------------------- 1 | version=@version@ 2 | minGroovyVersion=@minGroovyVersion@ 3 | maxGroovyVersion=@maxGroovyVersion@ -------------------------------------------------------------------------------- /spock-groovy2-compat/groovy2-compat.gradle: -------------------------------------------------------------------------------- 1 | //Module with compatibility layer to keep codebase compilable with both Groovy 2.5 and 3.0 2 | // 3 | //WARNING. Do not mix groovy:3.x and spock-groovy2-compat:2.x-groovy-2.5 jars on classpath! 4 | 5 | apply from: script("publishMaven") 6 | 7 | ext.displayName = "Spock Framework - Groovy 2 Compatibility Module" 8 | 9 | description = "Spock's Groovy 2 Compatibility Module provides support for using Spock 2 with Groovy 2.5." 10 | 11 | tasks.named("jar", Jar) { 12 | manifest { 13 | attributes( 14 | 'Build-Revision': versioning.info.commit, 15 | 'Specification-Title': project.name, 16 | 'Specification-Version': baseVersion, 17 | 'Specification-Vendor': 'spockframework.org', 18 | 'Implementation-Title': project.name, 19 | 'Implementation-Version': variantLessVersion, 20 | 'Implementation-Vendor': 'spockframework.org', 21 | 'Automatic-Module-Name': 'org.spockframework.groovy2-compat' 22 | ) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spock-guice/src/main/java/spock/guice/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | /** 16 | * Integration with Guice 2/3. 17 | */ 18 | package spock.guice; 19 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/BindingAnnotation1.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.guice 18 | 19 | import com.google.inject.BindingAnnotation 20 | import java.lang.annotation.Retention 21 | import java.lang.annotation.RetentionPolicy 22 | 23 | @BindingAnnotation 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @interface BindingAnnotation1 {} 26 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/BindingAnnotation2.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.guice 18 | 19 | import com.google.inject.BindingAnnotation 20 | import java.lang.annotation.Retention 21 | import java.lang.annotation.RetentionPolicy 22 | 23 | @BindingAnnotation 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @interface BindingAnnotation2 {} 26 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/IService1.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.guice 2 | 3 | /* 4 | * Copyright 2009 the original author or authors. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * https://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | interface IService1 { 20 | String generateString() 21 | } 22 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/IService2.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.guice 16 | 17 | interface IService2 { 18 | String generateQuickBrownFox(); 19 | } 20 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/MockModule.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.guice 2 | 3 | import spock.mock.DetachedMockFactory 4 | 5 | import com.google.inject.AbstractModule 6 | 7 | class MockModule extends AbstractModule { 8 | @Override 9 | protected void configure() { 10 | DetachedMockFactory detachedMockFactory = new DetachedMockFactory() 11 | bind(IService1).toInstance(detachedMockFactory.Mock(IService1)) 12 | bind(IService2).toInstance(detachedMockFactory.Stub(IService2)) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/MockSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.guice 2 | 3 | import spock.guice.UseModules 4 | import spock.lang.Specification 5 | 6 | import javax.inject.Inject 7 | 8 | @UseModules(MockModule) 9 | class MockSpec extends Specification { 10 | 11 | @Inject 12 | IService1 service1 13 | 14 | @Inject 15 | IService2 service2 16 | 17 | def "mocks and stubs are auto attached on injection" () { 18 | given: 19 | service1.generateString() >> 'hello' 20 | service2.generateQuickBrownFox() >> 'world' 21 | 22 | expect: 23 | service1.generateString() == 'hello' 24 | service2.generateQuickBrownFox() == 'world' 25 | } 26 | 27 | 28 | def "mocking works as well" () { 29 | when: 30 | service1.generateString() == 'hello' 31 | 32 | then: 33 | 1 * service1.generateString() >> 'hello' 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/Module2.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package org.spockframework.guice 17 | 18 | import com.google.inject.AbstractModule 19 | 20 | class Module2 extends AbstractModule { 21 | protected void configure() { 22 | bind(IService2).to(Service2) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/Service1.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.guice 18 | 19 | class Service1 implements IService1 { 20 | String generateString() { 21 | "foo" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-guice/src/test/groovy/org/spockframework/guice/Service2.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2010 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package org.spockframework.guice 17 | 18 | class Service2 implements IService2 { 19 | String generateQuickBrownFox() { 20 | return "The quick brown fox jumps over the lazy dog."; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spock-junit4/src/main/java/org/spockframework/junit4/ExceptionAdapterExtension.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.junit4; 2 | 3 | import org.spockframework.runtime.extension.*; 4 | import org.spockframework.runtime.model.*; 5 | 6 | public class ExceptionAdapterExtension implements IGlobalExtension { 7 | 8 | private static final ExceptionAdapterInterceptor exceptionAdapterInterceptor = new ExceptionAdapterInterceptor(); 9 | 10 | @Override 11 | public void visitSpec(SpecInfo spec) { 12 | spec.getAllFixtureMethods().forEach(it -> it.addInterceptor(exceptionAdapterInterceptor)); 13 | 14 | spec.getBottomSpec().getAllFeatures().forEach(this::addInterceptorToFeature); 15 | } 16 | 17 | private void addInterceptorToFeature(FeatureInfo featureInfo) { 18 | featureInfo.getFeatureMethod().addInterceptor(exceptionAdapterInterceptor); 19 | featureInfo.addIterationInterceptor(exceptionAdapterInterceptor); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spock-junit4/src/main/java/org/spockframework/junit4/ExceptionAdapterInterceptor.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.junit4; 2 | 3 | import org.spockframework.runtime.extension.*; 4 | 5 | import org.junit.internal.AssumptionViolatedException; 6 | import org.junit.runners.model.MultipleFailureException; 7 | import org.opentest4j.*; 8 | 9 | public class ExceptionAdapterInterceptor implements IMethodInterceptor { 10 | @Override 11 | public void intercept(IMethodInvocation invocation) throws Throwable { 12 | try { 13 | invocation.proceed(); 14 | } catch (AssumptionViolatedException assumption) { 15 | throw new TestAbortedException(assumption.getMessage(), assumption); 16 | } catch (MultipleFailureException mfe) { 17 | throw new MultipleFailuresError("There were multiple errors", mfe.getFailures()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spock-junit4/src/main/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension: -------------------------------------------------------------------------------- 1 | org.spockframework.junit4.RuleExtension 2 | org.spockframework.junit4.ClassRuleExtension 3 | org.spockframework.junit4.JUnit4AnnotationLifecycleMethodsExtension 4 | org.spockframework.junit4.ExceptionAdapterExtension 5 | -------------------------------------------------------------------------------- /spock-junit4/src/test/groovy/org/spockframework/junit/Base.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.junit; 16 | 17 | import org.junit.*; 18 | 19 | @Ignore 20 | public class Base { 21 | @Before 22 | public void before() { 23 | System.out.println("base"); 24 | } 25 | 26 | @Ignore 27 | @Test 28 | public void one() {} 29 | 30 | @Test 31 | public void odne() {} 32 | } 33 | -------------------------------------------------------------------------------- /spock-junit4/src/test/groovy/org/spockframework/junit/Derived.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.junit; 16 | 17 | import org.junit.*; 18 | 19 | @Ignore 20 | public class Derived extends Base { 21 | @Before 22 | public void before() { 23 | System.out.println("derived"); 24 | } 25 | 26 | @Ignore 27 | @Test 28 | public void two() {} 29 | } 30 | -------------------------------------------------------------------------------- /spock-junit4/src/test/groovy/org/spockframework/junit4/junit/JUnitBaseSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.junit4.junit 2 | 3 | import spock.lang.Specification 4 | import spock.util.EmbeddedSpecCompiler 5 | import spock.util.EmbeddedSpecRunner 6 | 7 | class JUnitBaseSpec extends Specification { 8 | EmbeddedSpecRunner runner = new EmbeddedSpecRunner() 9 | EmbeddedSpecCompiler compiler = new EmbeddedSpecCompiler() 10 | } 11 | -------------------------------------------------------------------------------- /spock-junit4/src/test/groovy/org/spockframework/smoke/traits/MyTraitWithJUnit4Annotations.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.spockframework.smoke.traits 17 | 18 | import org.junit.* 19 | 20 | trait MyTraitWithJUnit4Annotations { 21 | @Before 22 | void before() { 23 | beforeEvaluated = true 24 | } 25 | 26 | @After 27 | void after() { 28 | afterEvaluated = true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spock-specs/SpockTestConfig.groovy: -------------------------------------------------------------------------------- 1 | import java.time.Duration 2 | 3 | runner { 4 | parallel { 5 | enabled true 6 | } 7 | } 8 | 9 | timeout { 10 | globalTimeout Duration.ofMinutes(1) 11 | applyGlobalTimeoutToFixtures true 12 | maxInterruptAttemptsWithThreadDumps 1 13 | printThreadDumpsOnInterruptAttempts true 14 | } 15 | -------------------------------------------------------------------------------- /spock-specs/src/main/resources/META-INF/services/org.codehaus.groovy.transform.ASTTransformation: -------------------------------------------------------------------------------- 1 | org.spockframework.specs.jacoco.JacocoAstDumpTrigger 2 | -------------------------------------------------------------------------------- /spock-specs/src/test-groovy-ge-3.0/groovy/org/spockframework/smoke/ArrayInitializer.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke 2 | 3 | import spock.lang.Specification 4 | 5 | class ArrayInitializer extends Specification { 6 | 7 | def "array initializer in condition does not throw NullPointerException"() { 8 | expect: 9 | new Object[] { _ } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spock-specs/src/test-groovy-ge-3.0/groovy/org/spockframework/smoke/lamba/LambdaSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.lamba 2 | 3 | import spock.lang.Specification 4 | 5 | import static java.util.Comparator.comparingInt 6 | import static java.util.stream.Collectors.toList 7 | 8 | class LambdaSpec extends Specification { 9 | 10 | private List names = ["Fred", "Wilma", "Barney", "Betty"] 11 | 12 | def "allow to use Java lambda in spec"() { 13 | when: 14 | List longNames = names.stream().filter(name -> name.length() > 5).collect(toList()) 15 | 16 | then: 17 | longNames == ["Barney"] 18 | } 19 | 20 | def "allow to use method reference in spec"() { 21 | when: 22 | List namesFromShortest = names.stream().sorted(comparingInt(String::length).reversed()).collect(toList()) 23 | 24 | then: 25 | namesFromShortest == ["Barney", "Wilma", "Betty", "Fred"] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spock-specs/src/test-groovy-ge-4.0/groovy/org/spockframework/smoke/condition/ConditionG4Spec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.condition 2 | 3 | import spock.lang.Issue 4 | import spock.lang.Specification 5 | 6 | class ConditionG4Spec extends Specification { 7 | 8 | @Issue("https://github.com/spockframework/spock/issues/1956") 9 | def "test range"() { 10 | expect: 11 | (0..5) == [0, 1, 2, 3, 4, 5] 12 | (0<..5) == [1, 2, 3, 4, 5] 13 | (0..<5) == [0, 1, 2, 3, 4] 14 | (0<..<5) == [1, 2, 3, 4] 15 | } 16 | 17 | @Issue("https://github.com/spockframework/spock/issues/1845") 18 | def "explicit assert in switch expression"() { 19 | expect: 20 | def b = 3 21 | !!switch (b) { 22 | case 3 -> assert 1 == 1 23 | default -> assert 1 == 1 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/datadriven/v1/MathSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.datadriven.v1 2 | 3 | import spock.lang.Specification 4 | 5 | // tag::example[] 6 | class MathSpec extends Specification { 7 | def "maximum of two numbers"() { 8 | expect: 9 | // exercise math method for a few different inputs 10 | Math.max(1, 3) == 3 11 | Math.max(7, 4) == 7 12 | Math.max(0, 0) == 0 13 | } 14 | } 15 | // end::example[] 16 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/datadriven/v2/MathSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.datadriven.v2 2 | 3 | import spock.lang.Specification 4 | 5 | // tag::example[] 6 | // tag::example-a[] 7 | class MathSpec extends Specification { 8 | def "maximum of two numbers"(int a, int b, int c) { 9 | expect: 10 | Math.max(a, b) == c 11 | // end::example-a[] 12 | 13 | where: 14 | a | b | c 15 | 1 | 3 | 3 16 | 7 | 4 | 7 17 | 0 | 0 | 0 18 | // tag::example-b[] 19 | } 20 | } 21 | // end::example-b[] 22 | // end::example[] 23 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/datadriven/v3/MathSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.datadriven.v3 2 | 3 | import spock.lang.Specification 4 | 5 | // tag::example[] 6 | class MathSpec extends Specification { 7 | def "maximum of two numbers"() { 8 | expect: 9 | Math.max(a, b) == c 10 | 11 | where: 12 | a | b || c 13 | 1 | 3 || 3 14 | 7 | 4 || 7 15 | 0 | 0 || 0 16 | } 17 | } 18 | // end::example[] 19 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/datadriven/v4/MathSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.datadriven.v4 2 | 3 | import spock.lang.Rollup 4 | import spock.lang.Specification 5 | 6 | class MathSpec extends Specification { 7 | // tag::example[] 8 | @Rollup 9 | def "maximum of two numbers"() { 10 | // end::example[] 11 | expect: 12 | Math.max(a, b) == c 13 | 14 | where: 15 | a | b || c 16 | 1 | 3 || 3 17 | 7 | 4 || 7 18 | 0 | 0 || 0 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/datadriven/v5/MathSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.datadriven.v5 2 | 3 | import spock.lang.Specification 4 | 5 | class MathSpec extends Specification { 6 | // tag::example[] 7 | def "maximum of #a and #b is #c"() { 8 | // end::example[] 9 | expect: 10 | Math.max(a, b) == c 11 | 12 | where: 13 | a | b || c 14 | 1 | 3 || 3 15 | 7 | 4 || 7 16 | 0 | 0 || 0 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/datadriven/v6/MathSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.datadriven.v6 2 | 3 | import spock.lang.Specification 4 | 5 | // tag::example[] 6 | class MathSpec extends Specification { 7 | def "maximum of two numbers"() { 8 | expect: 9 | Math.max(a, b) == c 10 | 11 | where: 12 | a ; b ;; c 13 | 1 ; 3 ;; 3 14 | 7 ; 4 ;; 7 15 | 0 ; 0 ;; 0 16 | } 17 | } 18 | // end::example[] 19 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/datadriven/v7/MathSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.datadriven.v7 2 | 3 | import spock.lang.Specification 4 | 5 | // tag::example[] 6 | class MathSpec extends Specification { 7 | def "maximum of two numbers"() { 8 | expect: 9 | Math.max(a, b) == c 10 | Math.max(d, e) == f 11 | 12 | where: 13 | a | b || c 14 | 1 | 3 || 3 15 | 7 | 4 || 7 16 | 0 | 0 || 0 17 | 18 | d ; e ;; f 19 | 1 ; 3 ;; 3 20 | 7 ; 4 ;; 7 21 | 0 ; 0 ;; 0 22 | } 23 | } 24 | // end::example[] 25 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/extension/ConfineMetaClassChangesDocSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.extension 2 | 3 | import spock.lang.Specification 4 | import spock.lang.Stepwise 5 | import spock.util.mop.ConfineMetaClassChanges 6 | 7 | // tag::example[] 8 | @Stepwise 9 | class ConfineMetaClassChangesDocSpec extends Specification { 10 | @ConfineMetaClassChanges(String) 11 | def "I run first"() { 12 | when: 13 | String.metaClass.someMethod = { delegate } 14 | 15 | then: 16 | String.metaClass.hasMetaMethod('someMethod') 17 | } 18 | 19 | def "I run second"() { 20 | when: 21 | "Foo".someMethod() 22 | 23 | then: 24 | thrown(MissingMethodException) 25 | } 26 | } 27 | // end::example[] 28 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/extension/IssueDocSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.extension 2 | 3 | import spock.lang.Issue 4 | import spock.lang.Specification 5 | 6 | // tag::example[] 7 | @Issue("https://my.issues.org/FOO-1") 8 | class IssueDocSpec extends Specification { 9 | @Issue("https://my.issues.org/FOO-2") 10 | def "Foo should do bar"() { 11 | expect: true 12 | } 13 | 14 | @Issue(["https://my.issues.org/FOO-3", "https://my.issues.org/FOO-4"]) 15 | def "I have two related issues"() { 16 | expect: true 17 | } 18 | 19 | @Issue(["https://my.issues.org/FOO-5", "https://my.issues.org/FOO-6"]) 20 | @Issue("https://my.issues.org/FOO-7") 21 | def "I have three related issues"() { 22 | expect: true 23 | } 24 | } 25 | // end::example[] 26 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/extension/RequiresDocSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.extension 2 | 3 | import spock.lang.Requires 4 | import spock.lang.Specification 5 | 6 | class RequiresDocSpec extends Specification { 7 | // tag::example-a[] 8 | @Requires({ os.windows }) 9 | def "I'll only run on Windows"() { 10 | // end::example-a[] 11 | expect: 12 | true 13 | } 14 | 15 | // tag::example-b[] 16 | @Requires({ os.windows }) 17 | @Requires({ jvm.java8 }) 18 | def "I'll run only on Windows with Java 8"() { 19 | // end::example-b[] 20 | expect: 21 | true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/extension/SeeDocSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.extension 2 | 3 | import spock.lang.See 4 | import spock.lang.Specification 5 | 6 | // tag::example[] 7 | @See("https://spockframework.org/spec") 8 | class SeeDocSpec extends Specification { 9 | @See(["https://en.wikipedia.org/wiki/Levenshtein_distance", "https://www.levenshtein.net/"]) 10 | def "Even more information is available on the feature"() { 11 | expect: true 12 | } 13 | 14 | @See("https://www.levenshtein.de/") 15 | @See(["https://en.wikipedia.org/wiki/Levenshtein_distance", "https://www.levenshtein.net/"]) 16 | def "And even more information is available on the feature"() { 17 | expect: true 18 | } 19 | } 20 | // end::example[] 21 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/extension/SubjectDocSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.extension 2 | 3 | import spock.lang.Specification 4 | import spock.lang.Subject 5 | 6 | // tag::example-a[] 7 | @Subject([Foo, Bar]) 8 | // end::example-a[] 9 | // tag::example-b[] 10 | @Subject(Foo) 11 | @Subject(Bar) 12 | // end::example-b[] 13 | // tag::example-common[] 14 | class SubjectDocSpec extends Specification { 15 | // end::example-common[] 16 | // tag::example-c[] 17 | @Subject 18 | Foo myFoo 19 | // end::example-c[] 20 | } 21 | 22 | class Foo { 23 | } 24 | 25 | class Bar { 26 | } 27 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/extension/TagDocSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.extension 2 | 3 | import spock.lang.Specification 4 | import spock.lang.Tag 5 | 6 | // tag::tag-extension[] 7 | @Tag("docs") 8 | class TagDocSpec extends Specification { 9 | def "has one tag"() { 10 | expect: true 11 | } 12 | 13 | @Tag("other") 14 | def "has two tags"() { 15 | expect: true 16 | } 17 | } 18 | // end::tag-extension[] 19 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/extension/UseDocSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.extension 2 | 3 | import spock.lang.Specification 4 | import spock.util.mop.Use 5 | 6 | // tag::example[] 7 | class ListExtensions { 8 | static avg(List list) { list.sum() / list.size() } 9 | } 10 | 11 | class UseDocSpec extends Specification { 12 | @Use(ListExtensions) 13 | def "can use avg() method"() { 14 | expect: 15 | [1, 2, 3].avg() == 2 16 | } 17 | } 18 | // end::example[] 19 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/interaction/BuilderExampleSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.interaction 2 | 3 | import spock.lang.Specification 4 | 5 | import groovy.transform.builder.* 6 | 7 | class BuilderExampleSpec extends Specification { 8 | 9 | def "build example"() { 10 | // tag::builder[] 11 | given: 12 | ThingBuilder builder = Mock() { 13 | _ >> _ 14 | } 15 | 16 | when: 17 | Thing thing = builder 18 | .id("id-42") 19 | .name("spock") 20 | .weight(100) 21 | .build() 22 | 23 | then: 24 | 1 * builder.build() >> new Thing(id: 'id-1337') 25 | thing.id == 'id-1337' 26 | // end::builder[] 27 | } 28 | } 29 | 30 | 31 | class Thing { 32 | String name 33 | String id 34 | int weight 35 | } 36 | 37 | 38 | @Builder(builderStrategy = ExternalStrategy, forClass = Thing) 39 | class ThingBuilder {} 40 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/utilities/AgeFilter.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.utilities; 2 | 3 | import java.time.*; 4 | import java.util.function.Predicate; 5 | 6 | // tag::age-filter-class[] 7 | public class AgeFilter implements Predicate { 8 | private final Clock clock; 9 | private final int age; 10 | 11 | public AgeFilter(Clock clock, int age) { // <1> 12 | this.clock = clock; 13 | this.age = age; 14 | } 15 | 16 | @Override 17 | public boolean test(LocalDate date) { 18 | return Period.between(date, LocalDate.now(clock)).getYears() >= age; // <2> 19 | } 20 | } 21 | // end::age-filter-class[] 22 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/utilities/ConditionBlockSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.utilities 2 | 3 | import org.spockframework.runtime.SpockAssertionError 4 | import spock.lang.FailsWith 5 | import spock.lang.Specification 6 | import spock.util.concurrent.AsyncConditions 7 | 8 | class ConditionBlockSpec extends Specification { 9 | 10 | @FailsWith(SpockAssertionError) 11 | def "evaluate fails with implicit condition using @ConditionBlock semantics"() { 12 | // tag::ConditionBlock-usage[] 13 | AsyncConditions conds = new AsyncConditions() 14 | 15 | when: 16 | Thread.start { 17 | //The method AsyncConditions.evaluate() is annotated with @ConditionBlock 18 | conds.evaluate { 19 | //There is an implicit assert here 20 | false 21 | } 22 | } 23 | 24 | then: 25 | conds.await() 26 | // end::ConditionBlock-usage[] 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/docs/utilities/OldMethodSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.docs.utilities 2 | 3 | import spock.lang.Specification 4 | 5 | class OldMethodSpec extends Specification { 6 | 7 | // tag::old-usage-spec[] 8 | def "Usage of the old() method"() { 9 | given: 10 | def x = 0 11 | 12 | when: 13 | x++ 14 | 15 | then: 16 | x == old(x) + 1 17 | } 18 | // end::old-usage-spec[] 19 | } 20 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/groovy/GroovyVarArgs.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.groovy 16 | 17 | class GroovyVarArgs { 18 | static String[] varArgMethod(int i, String... strings) { strings } 19 | static String[] arrayMethod(int i, String[] strings) { strings } 20 | } 21 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/mock/runtime/mockito/AccessProtectedJavaBaseClass.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock.runtime.mockito; 2 | 3 | class AccessProtectedJavaBaseClass { 4 | protected boolean accessible = true; 5 | } 6 | 7 | class AccessProtectedJavaSubClass extends AccessProtectedJavaBaseClass { 8 | boolean accessNonStaticFlag() { 9 | return accessible; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/runtime/model/IterationFilterSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model 2 | 3 | import spock.lang.Specification 4 | import spock.lang.Subject 5 | 6 | class IterationFilterSpec extends Specification { 7 | 8 | @Subject 9 | def filter = new IterationFilter() 10 | 11 | def "allows all indexes by default"() { 12 | expect: 13 | filter.isAllowed(0) 14 | filter.isAllowed(1) 15 | } 16 | 17 | def "allows only selected indexes after one has been allowed explicitly"() { 18 | when: 19 | filter.allow(0) 20 | 21 | then: 22 | filter.isAllowed(0) 23 | !filter.isAllowed(1) 24 | } 25 | 26 | def "allows all indexes after configured to do so"() { 27 | when: 28 | filter.allow(0) 29 | filter.allowAll() 30 | 31 | then: 32 | filter.isAllowed(0) 33 | filter.isAllowed(1) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/runtime/model/TestTagTest.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.runtime.model 2 | 3 | import spock.lang.Specification 4 | 5 | class TestTagTest extends Specification { 6 | 7 | def "allows valid tags" () { 8 | expect: 9 | TestTag.create(tag) 10 | 11 | where: 12 | tag << ['tag', 'tag_with_underscore', 'tag-with-dash', 'ʘ‿ʘ', '♥╣[-_-]╠♥️', '💩', /"'..?/] 13 | } 14 | 15 | def "forbids invalid characters in tags"(){ 16 | when: 17 | TestTag.create(tag) 18 | 19 | then: 20 | IllegalArgumentException e = thrown() 21 | e.message.contains(readableName) 22 | 23 | where: 24 | tag << [' ', '\n', '\t', '\r', '\u0000', '(', ')', '&', '|', '!'] 25 | readableName = Character.getName(tag.codePointAt(0)) 26 | } 27 | 28 | def "forbids empty or null tags"() { 29 | when: 30 | TestTag.create(tag) 31 | 32 | then: 33 | thrown(IllegalArgumentException) 34 | 35 | where: 36 | tag << ['', null] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/VoidGroovyStaticMethod.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.smoke 18 | 19 | /** 20 | * @author Peter Niederwieser 21 | */ 22 | class VoidGroovyStaticMethod { 23 | static void foo() {} 24 | 25 | } 26 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.ast.condition 2 | 3 | import spock.lang.VerifyAll 4 | 5 | import java.lang.annotation.Annotation 6 | 7 | class VerifyAllMethodsAstSpec extends BaseVerifyMethodsAstSpec { 8 | 9 | @Override 10 | Class getAnnotation() { 11 | VerifyAll 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.ast.condition 2 | 3 | import spock.lang.Verify 4 | 5 | import java.lang.annotation.Annotation 6 | 7 | class VerifyMethodsAstSpec extends BaseVerifyMethodsAstSpec { 8 | 9 | @Override 10 | Class getAnnotation() { 11 | Verify 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/condition/ConditionNotSatisfiedErrors.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.condition 2 | 3 | import spock.lang.Specification 4 | import org.spockframework.runtime.ConditionNotSatisfiedError 5 | 6 | class ConditionNotSatisfiedErrors extends Specification { 7 | def "each condition gets its own values (no undesired aliasing)"() { 8 | when: 9 | assert 1 == 2 10 | 11 | then: 12 | ConditionNotSatisfiedError e1 = thrown() 13 | 14 | when: 15 | assert 3 == 4 16 | 17 | then: 18 | ConditionNotSatisfiedError e2 = thrown() 19 | 20 | expect: 21 | e1.condition.values == [1, 2, false] 22 | e2.condition.values == [3, 4, false] 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/extension/TagExtension.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.extension 2 | 3 | import spock.lang.Specification 4 | import spock.lang.Tag 5 | 6 | @Tag("class-level") 7 | class TagExtension extends Specification { 8 | def "class level tags"() { 9 | expect: 10 | specificationContext.currentFeature.testTags.value == ["class-level"] 11 | } 12 | 13 | @Tag("method-level") 14 | def "method level tags"() { 15 | expect: 16 | specificationContext.currentFeature.testTags.value =~ ["class-level", "method-level"] 17 | } 18 | 19 | @Tag("multi-tags") 20 | @Tag("method-level") 21 | @Tag("method-level") 22 | def "multi tags"() { 23 | expect: 24 | specificationContext.currentFeature.testTags.value =~ ["class-level", "method-level" , "multi-tags"] 25 | } 26 | } 27 | 28 | class InheritedTagExtension extends TagExtension { 29 | def "inherited tags"() { 30 | expect: 31 | specificationContext.currentFeature.testTags.value =~ ["class-level"] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/mock/CompletableFutureSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.mock 2 | 3 | import spock.lang.Specification 4 | 5 | import java.util.concurrent.CompletableFuture 6 | 7 | class CompletableFutureSpec extends Specification { 8 | 9 | def "default answer for CompletableFuture should be completed future"() { 10 | given: 11 | TestService service = Stub() 12 | 13 | when: 14 | CompletableFuture receivedFuture = service.future 15 | 16 | then: 17 | receivedFuture.done 18 | !receivedFuture.completedExceptionally 19 | receivedFuture.get() == null 20 | } 21 | 22 | interface TestService { 23 | CompletableFuture getFuture() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/mock/OptionalSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.mock 2 | 3 | import spock.lang.Specification 4 | 5 | class OptionalSpec extends Specification { 6 | 7 | def "default answer for Optional should be Optional.empty()"() { 8 | given: 9 | TestService service = Stub() 10 | 11 | when: 12 | Optional result = service.value 13 | 14 | then: 15 | !result.present 16 | } 17 | 18 | interface TestService { 19 | Optional getValue() 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/mock/StreamSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.mock 2 | 3 | import spock.lang.Specification 4 | 5 | import java.util.stream.* 6 | 7 | class StreamSpec extends Specification { 8 | 9 | def "Streams are empty"() { 10 | given: 11 | StreamService service = Stub() 12 | 13 | expect: 14 | service.stringStream().count() == 0 15 | service.intStream().count() == 0 16 | service.doubleStream().count() == 0 17 | service.longStream().count() == 0 18 | } 19 | 20 | interface StreamService { 21 | Stream stringStream() 22 | IntStream intStream() 23 | DoubleStream doubleStream() 24 | LongStream longStream() 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/smoke/mock/StubBuilderSupport.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.mock 2 | 3 | import spock.lang.Specification 4 | 5 | class StubBuilderSupport extends Specification { 6 | 7 | def "Stubs support builder pattern"() { 8 | given: 9 | BuilderExample builder = Stub() { 10 | build() >> "world" 11 | } 12 | 13 | expect: 14 | builder.withKey("foo").withValue("bar").build() == "world" 15 | } 16 | 17 | def "builder pattern does not apply for methods returning Object"() { 18 | given: 19 | BuilderExample builder = Stub() { 20 | build() >> "world" 21 | } 22 | 23 | expect: 24 | builder.someMethodReturningObject().getClass() == Object 25 | } 26 | 27 | interface BuilderExample { 28 | BuilderExample withValue(String v) 29 | BuilderExample withKey(String v) 30 | String build() 31 | Object someMethodReturningObject() 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/util/HashMultisetSpec.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.util 18 | 19 | class HashMultisetSpec extends AbstractMultisetSpec { 20 | def IMultiset createMultiset(List elements) { 21 | new HashMultiset(elements) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/org/spockframework/util/ThreadSupportSpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.util 2 | 3 | import spock.lang.IgnoreIf 4 | import spock.lang.Requires 5 | import spock.lang.Specification 6 | 7 | class ThreadSupportSpec extends Specification { 8 | 9 | @Requires({ jvm.java21Compatible }) 10 | def "creates virtual threads if available"() { 11 | when: 12 | def thread = ThreadSupport.virtualThreadIfSupported("test", { }) 13 | 14 | then: 15 | thread.virtual 16 | thread.class != Thread 17 | thread.name == "test" 18 | } 19 | 20 | @IgnoreIf({ jvm.java21Compatible }) 21 | def "creates regular threads if not available"() { 22 | when: 23 | def thread = ThreadSupport.virtualThreadIfSupported("test", { }) 24 | 25 | then: 26 | thread.class == Thread 27 | thread.name == "test" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spock-specs/src/test/groovy/spock/config/ConfigSupport.groovy: -------------------------------------------------------------------------------- 1 | package spock.config 2 | 3 | import org.spockframework.builder.DelegatingScript 4 | import org.spockframework.runtime.ConfigurationBuilder 5 | import org.spockframework.runtime.GroovyRuntimeUtil 6 | 7 | trait ConfigSupport { 8 | 9 | ConfigurationBuilder builder = new ConfigurationBuilder() 10 | 11 | DelegatingScript closureToScript(final Closure closure) { 12 | return new ClosureScript(closure) 13 | } 14 | } 15 | 16 | class ClosureScript extends DelegatingScript { 17 | final Closure closure 18 | 19 | ClosureScript(Closure closure) { 20 | this.closure = closure 21 | } 22 | 23 | @Override 24 | Object run() { 25 | GroovyRuntimeUtil.invokeClosure(closure) 26 | return null 27 | } 28 | 29 | @Override 30 | void $setDelegate(Object delegate) { 31 | closure.resolveStrategy = Closure.DELEGATE_FIRST 32 | closure.delegate = delegate 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/groovy/JavaVarArgs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.groovy; 16 | 17 | public class JavaVarArgs { 18 | public static String[] varArgMethod(int i, String... strings) { return strings; } 19 | public static String[] arrayMethod(int i, String[] strings) { return strings; } 20 | } 21 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/mock/FinalClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.mock; 16 | 17 | public final class FinalClass { 18 | private final String value; 19 | 20 | public FinalClass(String value) { 21 | this.value = value; 22 | } 23 | 24 | public String getValue() { 25 | return value; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/mock/FinalJavaPerson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | public final class FinalJavaPerson { 20 | public void sing() {} 21 | } 22 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/mock/FinalMethodsJavaPerson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | public class FinalMethodsJavaPerson { 20 | public final void sing() {} 21 | } 22 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/mock/InterfaceWithNestedClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.mock; 18 | 19 | public interface InterfaceWithNestedClass { 20 | class Service { 21 | private Service() {} 22 | 23 | public static InterfaceWithNestedClass getInstance() { 24 | return null; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/mock/Issue520Repository.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.mock; 2 | 3 | import java.io.Serializable; 4 | 5 | public interface Issue520Repository { 6 | //Note: we need to compile this with Java, because Groovy 2.5 can't compile this: 7 | //unexpected token: ID persist(E e); 8 | ID persist(E e); 9 | } 10 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/smoke/CallChainException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.smoke; 18 | 19 | /** 20 | * @author Peter Niederwieser 21 | */ 22 | public class CallChainException extends RuntimeException {} 23 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/smoke/mock/IQuarterlyCompoundedDeposit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.smoke.mock; 18 | 19 | public interface IQuarterlyCompoundedDeposit extends IDeposit { 20 | default double getCompoundingPeriodInMonths() { 21 | return 3; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/smoke/mock/ISquare.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.smoke.mock; 18 | 19 | public interface ISquare { 20 | int getLength(); 21 | 22 | default int getArea() { 23 | return getLength() * getLength(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/smoke/mock/Item.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.smoke.mock; 18 | 19 | class Item { 20 | public int getId() { 21 | return 777; 22 | } 23 | public int getPrice() { 24 | return 10; 25 | } 26 | 27 | @Override 28 | public String toString() { 29 | return "#" + getId() + ": " + getPrice(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spock-specs/src/test/java/org/spockframework/smoke/mock/JavaCaller.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.smoke.mock; 2 | 3 | import java.util.concurrent.Callable; 4 | 5 | public class JavaCaller { 6 | public Throwable call(Callable callable) throws Exception { 7 | try { 8 | callable.call(); 9 | return null; 10 | } catch (Throwable t) { 11 | return t; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/META-INF/services/org.spockframework.mock.runtime.IMockMaker: -------------------------------------------------------------------------------- 1 | org.spockframework.docs.extension.FancyMockMaker 2 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/META-INF/services/org.spockframework.runtime.extension.IDefaultValueProviderExtension: -------------------------------------------------------------------------------- 1 | org.spockframework.mock.FinalClassDefaultValueProvider 2 | org.spockframework.smoke.mock.MaybeDefaultValueProvider 3 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/org/spockframework/runtime/InvalidConfig.txt: -------------------------------------------------------------------------------- 1 | runner { -------------------------------------------------------------------------------- /spock-specs/src/test/resources/org/spockframework/runtime/ValidConfig.txt: -------------------------------------------------------------------------------- 1 | runner { 2 | filterStackTrace false 3 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/org/spockframework/runtime/extensionDescriptor: -------------------------------------------------------------------------------- 1 | # some comment 2 | org.spockframework.runtime.Extension1 3 | #another comment 4 | 5 | 6 | org.spockframework.runtime.Extension2 -------------------------------------------------------------------------------- /spock-specs/src/test/resources/org/spockframework/smoke/extension/SampleFile.txt: -------------------------------------------------------------------------------- 1 | HelloWorld 2 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/.editorconfig: -------------------------------------------------------------------------------- 1 | # Disable formatting for snapshot data 2 | 3 | [*] 4 | indent_style = unset 5 | indent_size = unset 6 | end_of_line = unset 7 | insert_final_newline = false 8 | trim_trailing_whitespace = false 9 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/extension/SnapshotDocSpec/custom_matching.txt: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/extension/SnapshotDocSpec/multi_snapshot-otherId.txt: -------------------------------------------------------------------------------- 1 | other parameter -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/extension/SnapshotDocSpec/multi_snapshot.txt: -------------------------------------------------------------------------------- 1 | from parameter -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/extension/SnapshotDocSpec/using_field_based_snapshot.txt: -------------------------------------------------------------------------------- 1 | from field -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/extension/SnapshotDocSpec/using_parameter_based_snapshot.txt: -------------------------------------------------------------------------------- 1 | from parameter -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/primer/VerifyEachDocSpec/verifyEach_method.txt: -------------------------------------------------------------------------------- 1 | Multiple Failures (2 failures) 2 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[0] 1: 3 | Condition not satisfied: 4 | 5 | it == 2 6 | | | 7 | 1 false 8 | 9 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[2] 3: 10 | Condition not satisfied: 11 | 12 | it == 2 13 | | | 14 | 3 false 15 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/primer/VerifyEachDocSpec/verifyEach_with_index_method.txt: -------------------------------------------------------------------------------- 1 | Multiple Failures (2 failures) 2 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[1] 2: 3 | Condition not satisfied: 4 | 5 | it == expected[i] 6 | | | | || 7 | 2 | | |1 8 | | | 3 9 | | [1, 3, 4] 10 | false 11 | 12 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[2] 3: 13 | Condition not satisfied: 14 | 15 | it == expected[i] 16 | | | | || 17 | 3 | | |2 18 | | | 4 19 | | [1, 3, 4] 20 | false 21 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/docs/primer/VerifyEachDocSpec/verifyEach_with_namer_method.txt: -------------------------------------------------------------------------------- 1 | Multiple Failures (2 failures) 2 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[0] int(1): 3 | Condition not satisfied: 4 | 5 | it == 2 6 | | | 7 | 1 false 8 | 9 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[2] int(3): 10 | Condition not satisfied: 11 | 12 | it == 2 13 | | | 14 | 3 false 15 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/VerifyEachBlocks/rendering_of_the_item_can_be_customized_with_the_namer.txt: -------------------------------------------------------------------------------- 1 | Assertions failed for item[9] int(10): 2 | Condition not satisfied: 3 | 4 | it < 10 5 | | | 6 | 10 false 7 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/VerifyEachBlocks/verifyEach_fails_handles_nested_exceptions.txt: -------------------------------------------------------------------------------- 1 | Multiple Failures (2 failures) 2 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[4] 5: 3 | Condition failed with Exception: 4 | 5 | checks(it) 6 | | | 7 | | 5 8 | java.lang.RuntimeException: x == 5 9 | 10 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[6] 7: 11 | Condition not satisfied: 12 | 13 | x != 7 14 | | | 15 | 7 false 16 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/VerifyEachBlocks/verifyEach_handles_a_single_failed_element_verification.txt: -------------------------------------------------------------------------------- 1 | Assertions failed for item[9] 10: 2 | Condition not satisfied: 3 | 4 | it < 10 5 | | | 6 | 10 false 7 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/VerifyEachBlocks/verifyEach_handles_multiple_failed_element_verifications.txt: -------------------------------------------------------------------------------- 1 | Multiple Failures (5 failures) 2 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[0] 1: 3 | Condition not satisfied: 4 | 5 | it % 2 == 0 6 | | | | 7 | 1 1 false 8 | 9 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[2] 3: 10 | Condition not satisfied: 11 | 12 | it % 2 == 0 13 | | | | 14 | 3 1 false 15 | 16 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[4] 5: 17 | Condition not satisfied: 18 | 19 | it % 2 == 0 20 | | | | 21 | 5 1 false 22 | 23 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[6] 7: 24 | Condition not satisfied: 25 | 26 | it % 2 == 0 27 | | | | 28 | 7 1 false 29 | 30 | org.spockframework.runtime.SpockAssertionError: Assertions failed for item[8] 9: 31 | Condition not satisfied: 32 | 33 | it % 2 == 0 34 | | | | 35 | 9 1 false 36 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy: -------------------------------------------------------------------------------- 1 | package apackage 2 | 3 | import spock.lang.* 4 | 5 | @org.spockframework.runtime.model.SpecMetadata(filename = 'script.groovy', line = 1) 6 | public class apackage.ASpec extends spock.lang.Specification { 7 | 8 | @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = [])], parameterNames = []) 9 | public void $spock_feature_0_0() { 10 | org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) 11 | java.lang.Object nothing = null 12 | org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) 13 | this.getSpecificationContext().getMockController().leaveScope() 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy: -------------------------------------------------------------------------------- 1 | package apackage 2 | 3 | import spock.lang.* 4 | 5 | @org.spockframework.runtime.model.SpecMetadata(filename = 'script.groovy', line = 1) 6 | public class apackage.ASpec extends spock.lang.Specification implements groovy.lang.GroovyObject { 7 | 8 | @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = [])], parameterNames = []) 9 | public void $spock_feature_0_0() { 10 | org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) 11 | java.lang.Object nothing = null 12 | org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) 13 | this.getSpecificationContext().getMockController().leaveScope() 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy: -------------------------------------------------------------------------------- 1 | package aPackage 2 | import spock.lang.* 3 | 4 | class ASpec extends Specification { 5 | def "aFeature"() { 6 | /*--------- tag::snapshot[] ---------*/ 7 | @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = [])], parameterNames = []) 8 | public void $spock_feature_0_0() { 9 | org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) 10 | java.lang.Object nothing = null 11 | org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) 12 | this.getSpecificationContext().getMockController().leaveScope() 13 | } 14 | /*--------- end::snapshot[] ---------*/ 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_shows_compile_error_in_source.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 3: 'expect' is not allowed here; instead, use one of: [and, then] @ line 3, column 13. 4 | expect: 'none' 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/groovy_3_language_features.groovy: -------------------------------------------------------------------------------- 1 | public void loop() { 2 | do { 3 | this.println('once') 4 | } while (false) 5 | } 6 | 7 | public void methodRef() { 8 | [].forEach(java.lang.System::'print') 9 | } 10 | 11 | public void lambdas() { 12 | java.lang.Object lambda = ( java.lang.Object x) -> { 13 | x * x } 14 | java.lang.Object lambdaMultiArg = ( int a, int b) -> { 15 | a <=> b } 16 | java.lang.Object lambdaNoArg = ( ) -> { 17 | throw new java.lang.RuntimeException('bam') 18 | } 19 | } 20 | 21 | public void blockStatements() { 22 | with_label: 23 | { 24 | this.println(foo) 25 | } 26 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy: -------------------------------------------------------------------------------- 1 | @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) 2 | public void $spock_feature_0_0() { 3 | org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) 4 | this.with([''], { -> 5 | throw new java.lang.Exception('foo') 6 | }) 7 | org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) 8 | this.getSpecificationContext().getMockController().leaveScope() 9 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy: -------------------------------------------------------------------------------- 1 | @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) 2 | public void $spock_feature_0_0() { 3 | org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) 4 | this.verifyAll([''], { -> 5 | throw new java.lang.Exception('foo') 6 | }) 7 | org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) 8 | this.getSpecificationContext().getMockController().leaveScope() 9 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy: -------------------------------------------------------------------------------- 1 | @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) 2 | public void $spock_feature_0_0() { 3 | org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) 4 | this.verifyEach([''], { -> 5 | throw new java.lang.Exception('foo') 6 | }) 7 | org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) 8 | this.getSpecificationContext().getMockController().leaveScope() 9 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyAllMethodsAstSpec/methods_without_condition_declarations_stay_unchanged.groovy: -------------------------------------------------------------------------------- 1 | public class NonAssertions extends java.lang.Object { 2 | 3 | @spock.lang.VerifyAll 4 | public static void copy(java.lang.Integer a) { 5 | java.lang.Object uselessCopy = a 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/VerifyMethodsAstSpec/methods_without_condition_declarations_stay_unchanged.groovy: -------------------------------------------------------------------------------- 1 | public class NonAssertions extends java.lang.Object { 2 | 3 | @spock.lang.Verify 4 | public static void copy(java.lang.Integer a) { 5 | java.lang.Object uselessCopy = a 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/collection_conditions_work_with_nulls-[0].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a =~ b 4 | | | | 5 | | | null 6 | | false 7 | str 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/collection_conditions_work_with_nulls-[1].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a =~ b 4 | | | | 5 | | | null 6 | | false 7 | [1] 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/collection_conditions_work_with_nulls-[2].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a =~ b 4 | | | | 5 | | | [1] 6 | | false 7 | null 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/collection_conditions_work_with_nulls-[3].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a =~ b 4 | | | | 5 | | | str 6 | | false 7 | null 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/strict_collection_conditions_work_with_nulls-[0].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a ==~ b 4 | | | | 5 | | | null 6 | | false 7 | str 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/strict_collection_conditions_work_with_nulls-[1].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a ==~ b 4 | | | | 5 | | | null 6 | | false 7 | [1] 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/strict_collection_conditions_work_with_nulls-[2].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a ==~ b 4 | | | | 5 | | | [1] 6 | | false 7 | null 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/condition/ConditionEvaluation/strict_collection_conditions_work_with_nulls-[3].txt: -------------------------------------------------------------------------------- 1 | Condition not satisfied: 2 | 3 | a ==~ b 4 | | | | 5 | | | str 6 | | false 7 | null 8 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/DataTables/filtered_iterations_are_logged.txt: -------------------------------------------------------------------------------- 1 | Filtered iteration [i: 2, a: 1, b: 1, c: 2]: 2 | Condition not satisfied: 3 | 4 | i == 1 5 | | | 6 | 2 false 7 | 8 | at apackage.ASpec.a feature(script.groovy:15) 9 | 10 | Filtered iteration [i: 3, a: 1, b: 1, c: 3]: 11 | Condition not satisfied: 12 | 13 | i == 1 14 | | | 15 | 3 false 16 | 17 | at apackage.ASpec.a feature(script.groovy:15) 18 | 19 | Filtered iteration [i: 4, a: 2, b: 2, c: 1]: 20 | Condition not satisfied: 21 | 22 | i == 1 23 | | | 24 | 4 false 25 | 26 | at apackage.ASpec.a feature(script.groovy:15) 27 | 28 | Filtered iteration [i: 5, a: 2, b: 2, c: 2]: 29 | Condition not satisfied: 30 | 31 | i == 1 32 | | | 33 | 5 false 34 | 35 | at apackage.ASpec.a feature(script.groovy:15) 36 | 37 | Filtered iteration [i: 6, a: 2, b: 2, c: 3]: 38 | Condition not satisfied: 39 | 40 | i == 1 41 | | | 42 | 6 false 43 | 44 | at apackage.ASpec.a feature(script.groovy:15) 45 | 46 | -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_data_pipe_and_derived_data_variable_is_not_allowed.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 7: Derived data variables cannot be combined @ line 7, column 7. 4 | b = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_data_pipe_and_derived_data_variable_is_not_allowed_even_with_separator.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 8: Derived data variables cannot be combined @ line 8, column 7. 4 | b = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_data_pipe_and_derived_data_variable_is_not_allowed_even_with_separator_in_front.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 8: Derived data variables cannot be combined @ line 8, column 7. 4 | b = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_data_table_and_derived_data_variable_is_not_allowed.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 8: Derived data variables cannot be combined @ line 8, column 7. 4 | b = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_derived_data_variable_and_data_pipe_is_not_allowed.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 5: Derived data variables cannot be combined @ line 5, column 7. 4 | a = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_derived_data_variable_and_data_pipe_is_not_allowed_even_with_separator.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 5: Derived data variables cannot be combined @ line 5, column 7. 4 | a = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_derived_data_variable_and_data_pipe_is_not_allowed_even_with_separator_in_front.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 5: Derived data variables cannot be combined @ line 5, column 7. 4 | a = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_between_derived_data_variable_and_data_table_is_not_allowed.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 5: Derived data variables cannot be combined @ line 5, column 7. 4 | a = 1 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_outside_where_block_is_not_allowed.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 2: 'combined' is not allowed here; instead, use one of: [setup, given, expect, when, cleanup, where, end-of-method] @ line 2, column 7. 4 | true 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_combined_label_within_semicolon_data_table_row_is_not_allowed.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 5: Columns in data tables must not be labeled @ line 5, column 21. 4 | a ; combined: b 5 | ^ 6 | 7 | script.groovy: 6: Data table must have more than just the header row @ line 6, column 7. 8 | 1 ; 2 9 | ^ 10 | 11 | 2 errors -------------------------------------------------------------------------------- /spock-specs/src/test/resources/snapshots/org/spockframework/smoke/parameterization/InvalidWhereBlocks/using_filter_label_before_where_block_is_not_allowed.txt: -------------------------------------------------------------------------------- 1 | Unable to produce AST for this phase due to earlier compilation error: 2 | startup failed: 3 | script.groovy: 2: 'filter' is not allowed here; instead, use one of: [setup, given, expect, when, cleanup, where, end-of-method] @ line 2, column 7. 4 | true 5 | ^ 6 | 7 | 1 error -------------------------------------------------------------------------------- /spock-spring/boot2-test/src/main/java/org/spockframework/boot2/jpa/BookRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package org.spockframework.boot2.jpa; 19 | 20 | import org.springframework.data.repository.CrudRepository; 21 | 22 | /** 23 | * Spring-Data repository for {@link Book} entities. 24 | */ 25 | public interface BookRepository extends CrudRepository { 26 | } 27 | -------------------------------------------------------------------------------- /spock-spring/boot2-test/src/main/java/org/spockframework/boot2/service/ScopedHelloWorldService.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.boot2.service; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.ScopedProxyMode; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.context.annotation.RequestScope; 7 | 8 | @RequestScope(proxyMode = ScopedProxyMode.TARGET_CLASS) 9 | @Component 10 | public class ScopedHelloWorldService { 11 | 12 | @Value("${name:World Scope!}") 13 | private String name; 14 | 15 | public String getHelloMessage() { 16 | return "Hello " + this.name; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spock-spring/boot2-test/src/main/java/org/spockframework/boot2/web/HelloWorldController.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.boot2.web; 2 | 3 | import org.spockframework.boot2.service.HelloWorldService; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | /** 9 | * Spring-MVC controller class. 10 | */ 11 | @RestController 12 | public class HelloWorldController { 13 | 14 | private HelloWorldService service; 15 | 16 | @Autowired 17 | public HelloWorldController(HelloWorldService service) { 18 | this.service = service; 19 | } 20 | 21 | @RequestMapping("/") 22 | public String hello() { 23 | return service.getHelloMessage(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spock-spring/boot2-test/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | name= Spock 2 | logging.level.root=OFF 3 | spring.jpa.hibernate.ddl-auto=create 4 | -------------------------------------------------------------------------------- /spock-spring/boot3-test/src/main/java/org/spockframework/boot3/jpa/BookRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | package org.spockframework.boot3.jpa; 19 | 20 | import org.springframework.data.repository.CrudRepository; 21 | 22 | /** 23 | * Spring-Data repository for {@link Book} entities. 24 | */ 25 | public interface BookRepository extends CrudRepository { 26 | } 27 | -------------------------------------------------------------------------------- /spock-spring/boot3-test/src/main/java/org/spockframework/boot3/service/ScopedHelloWorldService.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.boot3.service; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.context.annotation.ScopedProxyMode; 5 | import org.springframework.stereotype.Component; 6 | import org.springframework.web.context.annotation.RequestScope; 7 | 8 | @RequestScope(proxyMode = ScopedProxyMode.TARGET_CLASS) 9 | @Component 10 | public class ScopedHelloWorldService { 11 | 12 | @Value("${name:World Scope!}") 13 | private String name; 14 | 15 | public String getHelloMessage() { 16 | return "Hello " + this.name; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spock-spring/boot3-test/src/main/java/org/spockframework/boot3/web/HelloWorldController.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.boot3.web; 2 | 3 | import org.spockframework.boot3.service.HelloWorldService; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | /** 9 | * Spring-MVC controller class. 10 | */ 11 | @RestController 12 | public class HelloWorldController { 13 | 14 | private HelloWorldService service; 15 | 16 | @Autowired 17 | public HelloWorldController(HelloWorldService service) { 18 | this.service = service; 19 | } 20 | 21 | @RequestMapping("/") 22 | public String hello() { 23 | return service.getHelloMessage(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spock-spring/boot3-test/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | name=Spock 2 | logging.level.root=OFF 3 | spring.jpa.hibernate.ddl-auto=create 4 | -------------------------------------------------------------------------------- /spock-spring/spring3-test/spring3-test.gradle: -------------------------------------------------------------------------------- 1 | def springVersion = "3.2.16.RELEASE" 2 | 3 | dependencies { 4 | implementation "org.springframework:spring-core" 5 | 6 | testImplementation projects.spockCore 7 | testImplementation "org.springframework:spring-context" 8 | testImplementation ("org.springframework:spring-test") 9 | 10 | testRuntimeOnly projects.spockSpring 11 | } 12 | 13 | 14 | configurations.all { 15 | resolutionStrategy.eachDependency { 16 | if (requested.group == "org.springframework" ) { 17 | useVersion(springVersion) 18 | } 19 | } 20 | } 21 | 22 | 23 | tasks.named("test", Test).configure { 24 | if (rootProject.ext.javaVersion >= 17) { 25 | jvmArgs( 26 | //Spring Framework requires access to java.lang.ClassLoader.defineClass() from org.springframework.cglib.core.ReflectUtils 27 | "--add-opens=java.base/java.lang=ALL-UNNAMED" 28 | ) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spock-spring/spring3-test/src/test/groovy/org/spockframework/spring3/RuntimeCompatibilitySpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring3 2 | 3 | import spock.lang.Specification 4 | 5 | import java.util.concurrent.Executor 6 | 7 | import org.springframework.beans.factory.annotation.Autowired 8 | import org.springframework.test.context.ContextConfiguration 9 | 10 | @ContextConfiguration(classes = TestConfig) 11 | class RuntimeCompatibilitySpec extends Specification { 12 | 13 | @Autowired 14 | Executor injectMe 15 | 16 | def "no runtime errors are thrown"() { 17 | expect: 18 | 1 == 1 19 | } 20 | 21 | def "injection works"() { 22 | expect: 23 | injectMe != null 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spock-spring/spring3-test/src/test/groovy/org/spockframework/spring3/TestConfig.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring3 2 | 3 | import spock.mock.DetachedMockFactory 4 | 5 | import java.util.concurrent.Executor 6 | 7 | import groovy.transform.CompileStatic 8 | import org.springframework.context.annotation.* 9 | 10 | @CompileStatic 11 | @Configuration 12 | class TestConfig { 13 | @Bean 14 | Executor executor() { 15 | new DetachedMockFactory().Stub(Executor) 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /spock-spring/spring5-test/spring5-test.gradle: -------------------------------------------------------------------------------- 1 | def springVersion = "5.0.2.RELEASE" 2 | 3 | dependencies { 4 | implementation "org.springframework:spring-core" 5 | 6 | testImplementation projects.spockCore 7 | testImplementation projects.spockSpring 8 | testImplementation libs.junit4 9 | testImplementation "org.springframework:spring-context" 10 | testImplementation ("org.springframework:spring-test") 11 | 12 | } 13 | 14 | 15 | configurations.all { 16 | resolutionStrategy.eachDependency { 17 | if (requested.group == "org.springframework" ) { 18 | useVersion(springVersion) 19 | } 20 | } 21 | } 22 | 23 | tasks.named("test", Test).configure { 24 | if (rootProject.ext.javaVersion >= 17) { 25 | jvmArgs( 26 | //Spring Framework requires access to java.lang.ClassLoader.defineClass() from org.springframework.cglib.core.ReflectUtils 27 | "--add-opens=java.base/java.lang=ALL-UNNAMED" 28 | ) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spock-spring/spring5-test/src/test/groovy/org/spockframework/spring5/NoMockConfig.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring5 2 | 3 | import groovy.transform.CompileStatic 4 | import org.springframework.context.annotation.Bean 5 | 6 | import java.util.concurrent.Callable 7 | import java.util.concurrent.ExecutorService 8 | 9 | @CompileStatic 10 | class NoMockConfig { 11 | 12 | @Bean 13 | ExecutorService executor() { 14 | throw new RuntimeException("This should not be called") 15 | } 16 | 17 | @Bean 18 | ServiceExecutor serviceExecutor(ExecutorService executorService) { 19 | return new ServiceExecutor(executorService) 20 | } 21 | 22 | 23 | } 24 | 25 | class ServiceExecutor { 26 | private final ExecutorService executorService 27 | 28 | ServiceExecutor(ExecutorService executorService) { 29 | this.executorService = executorService 30 | } 31 | 32 | def exec() { 33 | executorService.submit({"done"} as Callable).get() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spock-spring/spring5-test/src/test/groovy/org/spockframework/spring5/RuntimeCompatibilitySpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring5 2 | 3 | import spock.lang.Specification 4 | 5 | import java.util.concurrent.Executor 6 | 7 | import org.springframework.beans.factory.annotation.Autowired 8 | import org.springframework.test.context.ContextConfiguration 9 | 10 | @ContextConfiguration(classes = TestConfig) 11 | class RuntimeCompatibilitySpec extends Specification { 12 | 13 | @Autowired 14 | Executor injectMe 15 | 16 | def "no runtime errors are thrown"() { 17 | expect: 18 | 1 == 1 19 | } 20 | 21 | def "injection works"() { 22 | expect: 23 | injectMe != null 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spock-spring/spring5-test/src/test/groovy/org/spockframework/spring5/SpringBeanTest.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring5 2 | 3 | import org.spockframework.spring.SpringBean 4 | import org.springframework.beans.factory.annotation.Autowired 5 | import org.springframework.test.context.ContextConfiguration 6 | import spock.lang.Specification 7 | 8 | import java.util.concurrent.ExecutorService 9 | import java.util.concurrent.Future 10 | 11 | @ContextConfiguration(classes = NoMockConfig) 12 | class SpringBeanTest extends Specification { 13 | 14 | @Autowired 15 | ServiceExecutor serviceExecutor 16 | 17 | @SpringBean 18 | ExecutorService executor = Mock() 19 | 20 | def "replace executor"() { 21 | when: 22 | def result = serviceExecutor.exec() 23 | 24 | then: 25 | result == 'mocked' 26 | 1 * executor.submit(_) >> Stub(Future) { 27 | get() >> 'mocked' 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spock-spring/spring5-test/src/test/groovy/org/spockframework/spring5/SpringRunnerTest.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring5; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.test.context.ContextConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | 9 | /** 10 | * Make sure we still can correctly execute tests executed by the SpringRunner that are not spock tests 11 | */ 12 | @RunWith(SpringJUnit4ClassRunner.class) 13 | @ContextConfiguration 14 | public class SpringRunnerTest { 15 | 16 | @Test 17 | public void testThatSpringRunnerExecutesCorrectly() { 18 | Assert.assertTrue(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spock-spring/spring5-test/src/test/groovy/org/spockframework/spring5/TestConfig.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring5 2 | 3 | import groovy.transform.CompileStatic 4 | import org.springframework.context.annotation.Bean 5 | import org.springframework.context.annotation.Configuration 6 | import spock.mock.DetachedMockFactory 7 | 8 | import java.util.concurrent.Executor 9 | 10 | @CompileStatic 11 | @Configuration 12 | class TestConfig { 13 | @Bean 14 | Executor executor() { 15 | new DetachedMockFactory().Stub(Executor) 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /spock-spring/spring6-test/spring6-test.gradle: -------------------------------------------------------------------------------- 1 | def springVersion = "6.0.0" 2 | 3 | java { 4 | toolchain { 5 | languageVersion = JavaLanguageVersion.of(17) 6 | } 7 | } 8 | 9 | tasks.withType(JavaCompile).configureEach { 10 | javaCompiler = javaToolchains.compilerFor { 11 | languageVersion = JavaLanguageVersion.of(17) 12 | } 13 | options.encoding = 'UTF-8' 14 | } 15 | 16 | dependencies { 17 | implementation "org.springframework:spring-core" 18 | 19 | testImplementation projects.spockCore 20 | testImplementation projects.spockSpring 21 | testImplementation libs.junit4 22 | testImplementation "org.springframework:spring-context" 23 | testImplementation("org.springframework:spring-test") 24 | 25 | } 26 | 27 | 28 | configurations.all { 29 | resolutionStrategy.eachDependency { 30 | if (requested.group == "org.springframework" ) { 31 | useVersion(springVersion) 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spock-spring/spring6-test/src/test/groovy/org/spockframework/spring6/NoMockConfig.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring6 2 | 3 | import groovy.transform.CompileStatic 4 | import org.springframework.context.annotation.Bean 5 | 6 | import java.util.concurrent.Callable 7 | import java.util.concurrent.ExecutorService 8 | 9 | @CompileStatic 10 | class NoMockConfig { 11 | 12 | @Bean 13 | ExecutorService executor() { 14 | throw new RuntimeException("This should not be called") 15 | } 16 | 17 | @Bean 18 | ServiceExecutor serviceExecutor(ExecutorService executorService) { 19 | return new ServiceExecutor(executorService) 20 | } 21 | 22 | 23 | } 24 | 25 | class ServiceExecutor { 26 | private final ExecutorService executorService 27 | 28 | ServiceExecutor(ExecutorService executorService) { 29 | this.executorService = executorService 30 | } 31 | 32 | def exec() { 33 | executorService.submit({"done"} as Callable).get() 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spock-spring/spring6-test/src/test/groovy/org/spockframework/spring6/RuntimeCompatibilitySpec.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring6 2 | 3 | import org.springframework.beans.factory.annotation.Autowired 4 | import org.springframework.test.context.ContextConfiguration 5 | import spock.lang.Specification 6 | 7 | import java.util.concurrent.Executor 8 | 9 | @ContextConfiguration(classes = TestConfig) 10 | class RuntimeCompatibilitySpec extends Specification { 11 | 12 | @Autowired 13 | Executor injectMe 14 | 15 | def "no runtime errors are thrown"() { 16 | expect: 17 | 1 == 1 18 | } 19 | 20 | def "injection works"() { 21 | expect: 22 | injectMe != null 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spock-spring/spring6-test/src/test/groovy/org/spockframework/spring6/SpringBeanTest.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring6 2 | 3 | import org.spockframework.spring.SpringBean 4 | import org.springframework.beans.factory.annotation.Autowired 5 | import org.springframework.test.context.ContextConfiguration 6 | import spock.lang.Specification 7 | 8 | import java.util.concurrent.ExecutorService 9 | import java.util.concurrent.Future 10 | 11 | @ContextConfiguration(classes = NoMockConfig) 12 | class SpringBeanTest extends Specification { 13 | 14 | @Autowired 15 | ServiceExecutor serviceExecutor 16 | 17 | @SpringBean 18 | ExecutorService executor = Mock() 19 | 20 | def "replace executor"() { 21 | when: 22 | def result = serviceExecutor.exec() 23 | 24 | then: 25 | result == 'mocked' 26 | 1 * executor.submit(_) >> Stub(Future) { 27 | get() >> 'mocked' 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spock-spring/spring6-test/src/test/groovy/org/spockframework/spring6/SpringRunnerTest.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring6; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.test.context.ContextConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | 9 | /** 10 | * Make sure we still can correctly execute tests executed by the SpringRunner that are not spock tests 11 | */ 12 | @RunWith(SpringJUnit4ClassRunner.class) 13 | @ContextConfiguration 14 | public class SpringRunnerTest { 15 | 16 | @Test 17 | public void testThatSpringRunnerExecutesCorrectly() { 18 | Assert.assertTrue(true); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spock-spring/spring6-test/src/test/groovy/org/spockframework/spring6/TestConfig.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring6 2 | 3 | import groovy.transform.CompileStatic 4 | import org.springframework.context.annotation.Bean 5 | import org.springframework.context.annotation.Configuration 6 | import spock.mock.DetachedMockFactory 7 | 8 | import java.util.concurrent.Executor 9 | 10 | @CompileStatic 11 | @Configuration 12 | class TestConfig { 13 | @Bean 14 | Executor executor() { 15 | new DetachedMockFactory().Stub(Executor) 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /spock-spring/src/main/java/org/spockframework/spring/mock/Definition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring.mock; 18 | 19 | interface Definition { 20 | String getName(); 21 | QualifierDefinition getQualifier(); 22 | } 23 | -------------------------------------------------------------------------------- /spock-spring/src/main/java/org/spockframework/spring/mock/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * This whole package as adapted from the spring-boot-test module specifically, 19 | * from the package {@code org.springframework.boot.test.mock.mockito} 20 | */ 21 | package org.spockframework.spring.mock; 22 | -------------------------------------------------------------------------------- /spock-spring/src/main/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension: -------------------------------------------------------------------------------- 1 | org.spockframework.spring.SpringExtension -------------------------------------------------------------------------------- /spock-spring/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Spring Test ContextCustomizerFactories 2 | org.springframework.test.context.ContextCustomizerFactory=\ 3 | org.spockframework.spring.mock.SpockContextCustomizerFactory 4 | 5 | 6 | # Test Execution Listeners 7 | org.springframework.test.context.TestExecutionListener=\ 8 | org.spockframework.spring.SpringMockTestExecutionListener 9 | -------------------------------------------------------------------------------- /spock-spring/src/main/resources/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | http\://www.spockframework.org/spring=org.spockframework.spring.xml.SpockNamespaceHandler -------------------------------------------------------------------------------- /spock-spring/src/main/resources/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | http\://www.spockframework.org/spring/spock.xsd=org/spockframework/spock.xsd 2 | https\://www.spockframework.org/spring/spock.xsd=org/spockframework/spock.xsd 3 | -------------------------------------------------------------------------------- /spock-spring/src/test/groovy/org/spockframework/spring/IService1.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring 18 | 19 | interface IService1 { 20 | String generateString() 21 | } 22 | -------------------------------------------------------------------------------- /spock-spring/src/test/groovy/org/spockframework/spring/IService2.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring 18 | 19 | interface IService2 { 20 | String generateQuickBrownFox() 21 | } 22 | -------------------------------------------------------------------------------- /spock-spring/src/test/groovy/org/spockframework/spring/Service1.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring 18 | 19 | class Service1 implements IService1 { 20 | private IService2 service2 21 | 22 | Service1(Service2 service2) { 23 | this.service2 = service2 24 | } 25 | 26 | String generateString() { 27 | service2.generateQuickBrownFox() 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spock-spring/src/test/groovy/org/spockframework/spring/Service2.groovy: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Copyright 2017 the original author or authors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.spockframework.spring 19 | 20 | class Service2 implements IService2 { 21 | def String generateQuickBrownFox() { 22 | "The quick brown fox jumps over the lazy dog." 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spock-spring/src/test/groovy/org/spockframework/spring/docs/GreeterService.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring.docs; 18 | 19 | interface GreeterService { 20 | String getGreeting() 21 | } 22 | -------------------------------------------------------------------------------- /spock-spring/src/test/groovy/org/spockframework/spring/docs/GreeterServiceImpl.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring.docs 18 | 19 | class GreeterServiceImpl implements GreeterService { 20 | @Override 21 | String getGreeting() { 22 | return 'Hello World' 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spock-spring/src/test/groovy/org/spockframework/spring/docs/StubBeansExamples.groovy: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring.docs 2 | 3 | import org.spockframework.spring.Service2 4 | import org.spockframework.spring.StubBeans 5 | import org.spockframework.spring.mock.DemoMockContext 6 | import spock.lang.Specification 7 | 8 | import org.springframework.test.context.ContextConfiguration 9 | 10 | //tag::example[] 11 | @StubBeans(Service2) 12 | @ContextConfiguration(classes = DemoMockContext) 13 | class StubBeansExamples extends Specification { 14 | //end::example[] 15 | 16 | def "context loads"() { 17 | expect: true 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spock-spring/src/test/java/org/spockframework/spring/mock/imported/example/DeclaredException.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring.mock.imported.example; 2 | 3 | public class DeclaredException extends Exception { 4 | } 5 | -------------------------------------------------------------------------------- /spock-spring/src/test/java/org/spockframework/spring/mock/imported/example/ExampleExtraInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring.mock.imported.example; 18 | 19 | /** 20 | * Example extra interface for mocking tests. 21 | * 22 | * @author Phillip Webb 23 | */ 24 | public interface ExampleExtraInterface { 25 | 26 | String doExtra(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spock-spring/src/test/java/org/spockframework/spring/mock/imported/example/ExampleService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.spring.mock.imported.example; 18 | 19 | /** 20 | * Example service interface for mocking tests. 21 | * 22 | * @author Phillip Webb 23 | */ 24 | public interface ExampleService { 25 | 26 | String greeting(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /spock-spring/src/test/java/org/spockframework/spring/mock/imported/example/ServiceWithDeclaredException.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring.mock.imported.example; 2 | 3 | public interface ServiceWithDeclaredException { 4 | String doWork() throws DeclaredException; 5 | } 6 | -------------------------------------------------------------------------------- /spock-spring/src/test/java/org/spockframework/spring/mock/imported/example/UndeclaredException.java: -------------------------------------------------------------------------------- 1 | package org.spockframework.spring.mock.imported.example; 2 | 3 | public class UndeclaredException extends Exception { 4 | } 5 | -------------------------------------------------------------------------------- /spock-spring/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger = WARN, X 2 | 3 | #log4j.logger.org.springframework.transaction=DEBUG 4 | #log4j.logger.org.springframework.test=DEBUG 5 | 6 | log4j.appender.X=org.apache.log4j.ConsoleAppender 7 | log4j.appender.X.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.X.layout.conversionPattern=%m%n 9 | -------------------------------------------------------------------------------- /spock-spring/src/test/resources/org/spockframework/spring/InjectionExamples-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spock-spring/src/test/resources/org/spockframework/spring/ScopedBeansMock-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /spock-spring/src/test/resources/org/spockframework/spring/TransactionalExample-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /spock-spring/src/test/resources/org/spockframework/spring/TransactionalGroovySqlExample-context.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spock-tapestry/src/main/resources/META-INF/services/org.spockframework.runtime.extension.IGlobalExtension: -------------------------------------------------------------------------------- 1 | org.spockframework.tapestry.TapestryExtension -------------------------------------------------------------------------------- /spock-tapestry/src/test/java/org/spockframework/tapestry/IService1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.tapestry; 18 | 19 | public interface IService1 { 20 | String generateString(); 21 | } 22 | -------------------------------------------------------------------------------- /spock-tapestry/src/test/java/org/spockframework/tapestry/IService2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.tapestry; 18 | 19 | public interface IService2 { 20 | String generateQuickBrownFox(); 21 | } 22 | -------------------------------------------------------------------------------- /spock-tapestry/src/test/java/org/spockframework/tapestry/IService3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.tapestry; 18 | 19 | public interface IService3 { 20 | String generateString(); 21 | } 22 | -------------------------------------------------------------------------------- /spock-tapestry/src/test/java/org/spockframework/tapestry/Service2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.spockframework.tapestry; 18 | 19 | public class Service2 implements IService2 { 20 | public String generateQuickBrownFox() { 21 | return "The quick brown fox jumps over the lazy dog."; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/platform/DontSwallowErrorTest.java: -------------------------------------------------------------------------------- 1 | package spock.platform; 2 | 3 | import spock.testkit.oom.OomSpec; 4 | 5 | import org.junit.jupiter.api.*; 6 | 7 | import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; 8 | 9 | public class DontSwallowErrorTest extends SpockEngineBase { 10 | 11 | @Test 12 | void verifyUnrollExample() { 13 | Assertions.assertThrows(OutOfMemoryError.class, 14 | () -> execute(selectClass(OomSpec.class), stats -> stats.started(1))); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/oom/OomSpec.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.oom 2 | 3 | import spock.lang.Specification 4 | 5 | class OomSpec extends Specification { 6 | def a() { 7 | expect: 8 | throw new OutOfMemoryError() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/ChildTagSpec.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.Tag 4 | 5 | @Tag("childSpec") 6 | class ChildTagSpec extends SimpleTagSpec { 7 | 8 | @Tag("shared") 9 | @Tag("child") 10 | def complex() { 11 | expect: true 12 | } 13 | 14 | def plain() { 15 | expect: true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/CleanupTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | 4 | import spock.lang.Specification 5 | 6 | class CleanupTestCase extends Specification { 7 | 8 | List sut 9 | 10 | def cleanup() { 11 | assert sut.empty 12 | } 13 | 14 | def "setup works"() { 15 | given: 16 | sut = [] 17 | when: 18 | sut.add('foo') 19 | 20 | then: 21 | sut.size() == 1 22 | 23 | cleanup: 24 | sut.clear() 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/ErrorTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.IgnoreIf 4 | import spock.lang.Specification 5 | 6 | class ErrorTestCase extends Specification { 7 | @IgnoreIf({ b }) 8 | def "error gets reported properly"() { 9 | expect: true 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/ExampleTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.* 4 | 5 | class ExampleTestCase extends Specification { 6 | 7 | def "first"() { 8 | expect: true 9 | } 10 | 11 | def "failMe"() { 12 | expect: false 13 | } 14 | 15 | @Ignore 16 | def "ignoreMe"() { 17 | expect: false 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/InheritedChildTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | class InheritedChildTestCase extends InheritedParentTestCase { 4 | 5 | def 'Test defined in child'() { 6 | expect: 1 == 1 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/InheritedParentTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | 4 | import spock.lang.Ignore 5 | import spock.lang.Specification 6 | 7 | class InheritedParentTestCase extends Specification { 8 | 9 | def "first"() { 10 | expect: true 11 | } 12 | 13 | def "failMe"() { 14 | expect: false 15 | } 16 | 17 | @Ignore 18 | def "ignoreMe"() { 19 | expect: false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/SetupCleanupTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.* 4 | 5 | class SetupCleanupTestCase extends Specification { 6 | 7 | List sut 8 | 9 | def setup() { 10 | sut = [] 11 | } 12 | 13 | def cleanup() { 14 | assert !sut.empty 15 | } 16 | 17 | def "setup works"() { 18 | when: 19 | sut.add('foo') 20 | 21 | then: 22 | sut.size() == 1 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/SharedSetupCleanupTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.Shared 4 | import spock.lang.Specification 5 | 6 | class SharedSetupCleanupTestCase extends Specification { 7 | 8 | @Shared 9 | List sut 10 | 11 | def setupSpec() { 12 | sut = [] 13 | } 14 | 15 | def cleanupSpec() { 16 | assert !sut.empty 17 | } 18 | 19 | def "setup works"() { 20 | when: 21 | sut.add('foo') 22 | 23 | then: 24 | sut.size() == 1 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/SimpleTagSpec.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.Specification 4 | import spock.lang.Tag 5 | 6 | @Tag("inherited") 7 | class SimpleTagSpec extends Specification { 8 | @Tag("shared") 9 | @Tag("simple") 10 | def simple() { 11 | expect: true 12 | } 13 | 14 | @Tag("complex") 15 | @Tag("shared") 16 | def complex() { 17 | expect: true 18 | } 19 | 20 | def bland() { 21 | expect: true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/StepwiseTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.* 4 | 5 | @Stepwise 6 | class StepwiseTestCase extends Specification { 7 | 8 | @Shared 9 | int counter = 0 10 | 11 | def setup() { 12 | counter++ 13 | } 14 | 15 | def "first"() { 16 | expect: counter == 1 17 | } 18 | 19 | def "second"() { 20 | expect: counter == 2 21 | } 22 | 23 | def "third"() { 24 | expect: counter == 3 25 | } 26 | 27 | def "fail"() { 28 | expect: false 29 | } 30 | 31 | def "fifth"() { 32 | expect: false 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spock-testkit/src/test/groovy/spock/testkit/testsources/UnrollTestCase.groovy: -------------------------------------------------------------------------------- 1 | package spock.testkit.testsources 2 | 3 | import spock.lang.* 4 | 5 | class UnrollTestCase extends Specification { 6 | 7 | def "unrollMe"() { 8 | expect: 9 | Math.max(a, b) == c 10 | 11 | where: 12 | a | b | c 13 | 1 | 2 | 2 14 | 2 | 2 | 0 15 | 3 | 2 | 3 16 | } 17 | 18 | 19 | @Unroll("Max of #a #b == #c") 20 | def "unrollMe2"() { 21 | expect: 22 | Math.max(a, b) == c 23 | 24 | where: 25 | a | b | c 26 | 1 | 2 | 2 27 | 2 | 2 | 2 28 | 3 | 2 | 3 29 | } 30 | 31 | def "Unroll #a #b == #c"() { 32 | expect: 33 | Math.max(a, b) == c 34 | 35 | where: 36 | a | b | c 37 | 1 | 2 | 2 38 | 2 | 2 | 2 39 | 3 | 2 | 3 40 | } 41 | 42 | @Rollup 43 | def "noExtraReporting"() { 44 | expect: 45 | Math.max(a, b) == c 46 | 47 | where: 48 | a | b | c 49 | 1 | 2 | 2 50 | 2 | 2 | 2 51 | 3 | 2 | 3 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /spock-unitils/src/main/java/spock/unitils/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | /** 16 | * Integration with Unitils. 17 | */ 18 | package spock.unitils; 19 | -------------------------------------------------------------------------------- /spock-unitils/src/test/groovy/org/spockframework/unitils/dbunit/User.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * https://www.apache.org/licenses/LICENSE-2.0 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.spockframework.unitils.dbunit 16 | 17 | class User { 18 | String firstName 19 | String lastName 20 | int age 21 | } 22 | -------------------------------------------------------------------------------- /spock-unitils/src/test/resources/org/spockframework/unitils/dbunit/UserDaoSpec.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /spock-unitils/src/test/resources/unitils.properties: -------------------------------------------------------------------------------- 1 | database.driverClassName=org.h2.Driver 2 | database.url=jdbc:h2:mem:userdb;IFEXISTS=TRUE 3 | database.dialect=h2 4 | database.userName= 5 | database.password= 6 | database.schemaNames=public 7 | database.storedIdentifierCase.h2=auto 8 | database.identifierQuoteString.h2=auto 9 | org.unitils.core.dbsupport.DbSupport.implClassName.h2=org.unitils.core.dbsupport.H2DbSupport 10 | org.dbunit.dataset.datatype.IDataTypeFactory.implClassName=org.dbunit.ext.h2.H2DataTypeFactory --------------------------------------------------------------------------------