Fix cached URL Option A playback behavior in spring example#69
Merged
sloppylopez merged 22 commits intofeat/1.2-Parametrized_testsfrom Mar 6, 2026
Merged
Conversation
…tegration to be able to run parametrized tests
…h-parameterized-tests Fix parameterized playback directory matching to avoid cross-invocation mock mixing
There was a problem hiding this comment.
Pull request overview
This PR updates StableMock’s Spring Boot example and core StableMock utilities to improve parameterized playback behavior (Option A) and make recorded artifacts/matching more robust.
Changes:
- Update the Spring example client to resolve
app.postmanecho.urlat request time (instead of caching it at bean construction). - Extend StableMock core to support dropping response headers from recorded stubs and filtering out certain scoped-request identity/plan ignore patterns at load time.
- Refresh example recorded fixtures and add focused unit tests for header-ignore, ignore-pattern filtering, and invocation-dir matching.
Reviewed changes
Copilot reviewed 207 out of 261 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/com/stablemock/core/storage/SingleAnnotationMappingStorageHeaderIgnoreTest.java | Adds tests validating response-header removal behavior for recorded mappings. |
| src/test/java/com/stablemock/core/analysis/AnalysisResultStorageTest.java | Adds test ensuring scoped-request identity/plan ignore patterns are filtered out at load time. |
| src/test/java/com/stablemock/StableMockExtensionTest.java | Adds test for stricter parameterized invocation directory matching. |
| src/main/java/com/stablemock/core/storage/MappingStorage.java | Extends mapping save API to pass through ignore-response-headers configuration. |
| src/main/java/com/stablemock/core/analysis/AnalysisResultStorage.java | Adds overload + filtering logic for scoped-request identity/plan ignore patterns. |
| src/main/java/com/stablemock/U.java | Expands @U annotation with ignoreResponseHeaders and paths options and updates documentation. |
| examples/spring-boot-example/src/main/java/example/CachedBaseUrlClient.java | Resolves base URL from Environment per request to support Option A per-invocation ports. |
| examples/spring-boot-example/src/test/java/example/flow/ParameterizedStableKeyScenarioIT.java | Updates class-level comment to clarify regression intent. |
| examples/spring-boot-example/src/test/resources/** | Updates/refreshes recorded StableMock fixtures and analysis artifacts used by example tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...stExample/testNonParameterizedRequest/mappings/get-dc975408-3c2d-46b0-a870-e3d33e5b3150.json
Outdated
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
CachedBaseUrlClientto readapp.postmanecho.urlfrom SpringEnvironmentat request time and to fail fast when the property is missing.CachedUrlFailsWithOptionAITinto a validating playback test that asserts HTTP 200 and verifies the expectedidis present in each parameterized response.UserControllercomment for/api/postmanecho/cached-users/{id}to clarify the endpoint covers a non-Feign, request-time URL resolution path.Testing
./gradlew :examples:spring-boot-example:test --tests "example.flow.CachedUrlFailsWithOptionAIT", but the Gradle wrapper download was blocked by a network/proxy error (HTTP/1.1 403 Forbidden).git status,git diff) and file inspections to verify the intended code changes and committed the patch successfully.Codex Task