New posts

This commit is contained in:
2026-11-06 21:44:06 +05:30
parent dc13293046
commit 8da3374155
51 changed files with 2099 additions and 0 deletions
@@ -0,0 +1,30 @@
# 1. framework defaults (a plain RestClient, no status handler)
findById(99) -> HttpClientErrorException$NotFound
status : 404 NOT_FOUND
message : 404 Not Found: "{"type":"https://stub.example/problems/post-not-found","title":"Post not found","status":404,"detail":"No post with id 99","instance":"/posts/99"}"
content-type: application/problem+json
getResponseBodyAs(ProblemDetail): title='Post not found' detail='No post with id 99' type=https://stub.example/problems/post-not-found
alwaysDown() -> HttpServerErrorException.ServiceUnavailable, status 503 SERVICE_UNAVAILABLE
# 2. a response that never comes: read timeout is 1500ms on the flaky group, /slow takes 3000ms
slow() -> ResourceAccessException, cause java.net.http.HttpTimeoutException
message: I/O error on GET request for "http://127.0.0.1:<port>/slow": Request cancelled
# 3. nobody listening
findAll() -> ResourceAccessException, cause java.net.ConnectException
# 4. Optional<Post> and ResponseEntity<Post> on a 404 with the default handler
findOptional(99) -> NotFound
findEntity(99) -> NotFound
# 5. NotFoundRestClientAdapterDecorator (spring-web 7.0.10) turns a 404 into an empty result
findById(99) -> null
findOptional(99) -> Optional.empty
findEntity(99) -> status 404 NOT_FOUND, body null
# 6. our own defaultStatusHandler on the "posts" group (UpstreamProblemStatusHandler)
findById(99) -> UpstreamNotFoundException: Upstream says not found: No post with id 99
problem.type=https://stub.example/problems/post-not-found instance=/posts/99
create(blank title) -> UpstreamValidationException: Upstream rejected the request: Validation failed
extension 'errors' = [{field=title, message=must not be blank}]
alwaysDown() -> UpstreamUnavailableException: Upstream unavailable (503): Upstream is down for maintenance