File tree Expand file tree Collapse file tree 5 files changed +50
-3
lines changed
main/java/de/gematik/zeta/testfachdienst
test/java/de/gematik/zeta/testfachdienst/controller Expand file tree Collapse file tree 5 files changed +50
-3
lines changed Original file line number Diff line number Diff line change 22
33# Release Notes ZETA Testfachdienst
44
5+ ## Release 0.3.0
6+
7+ TestFachdienst 0.3.0
8+
9+ This release starts the release notes for TestFachdienst beginning with version 0.3.0.
10+ It includes targeted API behavior updates and model validation adjustments.
11+
12+ #### Release Focus:
13+
14+ - Added ` GET /zeta-v1/hello-zeta/proxy-error ` endpoint to return a proxy-specific error response.
15+ - Added ` ZETA-Cause: Proxy ` response header with ` HTTP 400 Bad Request ` for the proxy error endpoint.
16+ - Added controller test coverage for the new proxy error response behavior.
17+ - Removed ` @PastOrPresent ` and ` @FutureOrPresent ` annotations from ` Erezept ` date fields.
18+
19+ ### Known issues:
20+
21+ - None documented for this release.
22+
523## Release 0.2.1
624
725### added:
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ plugins {
1515}
1616
1717group = " de.gematik.zeta"
18- version = " 0.1.3 "
18+ version = " 0.3.0 "
1919description =
2020 " achelos Testfachdienst providing a REST API with CRUD operations, secure communication via TLS and Websocket connections."
2121
Original file line number Diff line number Diff line change 2727import de .gematik .zeta .testfachdienst .model .HelloZetaResource ;
2828import de .gematik .zeta .testfachdienst .service .HelloZetaService ;
2929import lombok .extern .slf4j .Slf4j ;
30+ import org .springframework .http .HttpStatus ;
3031import org .springframework .http .ResponseEntity ;
3132import org .springframework .web .bind .annotation .GetMapping ;
3233import org .springframework .web .bind .annotation .RequestMapping ;
@@ -67,4 +68,18 @@ public ResponseEntity<HelloZetaResource> getHelloZetaResponse() {
6768 log .debug ("Got resource: '" + resource + "' from service, returning resource with 200." );
6869 return ResponseEntity .ok (resource );
6970 }
71+
72+ /**
73+ * Return a response that signals a proxy error to the caller.
74+ *
75+ * @return HTTP 400 response with ZETA-Cause header set to Proxy
76+ */
77+ @ GetMapping ("/proxy-error" )
78+ public ResponseEntity <HelloZetaResource > getHelloZetaProxyErrorResponse () {
79+ log .debug ("Returning proxy error response for HelloZeta." );
80+ HelloZetaResource resource = service .getHelloZetaResource ();
81+ return ResponseEntity .status (HttpStatus .BAD_REQUEST )
82+ .header ("ZETA-Cause" , "Proxy" )
83+ .body (resource );
84+ }
7085}
Original file line number Diff line number Diff line change @@ -72,13 +72,11 @@ public class Erezept {
7272 @ Schema (description = "Dosage instructions" , example = "1 tablet, 3× daily after meals" )
7373 private String dosage ;
7474
75- @ PastOrPresent
7675 @ Column (nullable = false )
7776 @ Schema (description = "When it was issued (ISO-8601)" , example = "2025-09-22T10:30:00Z" ,
7877 format = "date-time" )
7978 private OffsetDateTime issuedAt ;
8079
81- @ FutureOrPresent
8280 @ Schema (description = "When it expires (ISO-8601)" , example = "2025-12-31T23:59:59Z" ,
8381 format = "date-time" )
8482 private OffsetDateTime expiresAt ;
Original file line number Diff line number Diff line change @@ -62,4 +62,20 @@ void getHelloZetaResponse_returnsServicePayload() {
6262 assertThat (response .getStatusCode ().value ()).isEqualTo (200 );
6363 verify (service ).getHelloZetaResource ();
6464 }
65+
66+ /**
67+ * Verifies that the proxy error endpoint sets the ZETA-Cause header.
68+ */
69+ @ Test
70+ void getHelloZetaProxyErrorResponse_setsProxyHeader () {
71+ var resource = new HelloZetaResource ("Hello" );
72+ when (service .getHelloZetaResource ()).thenReturn (resource );
73+
74+ var response = controller .getHelloZetaProxyErrorResponse ();
75+
76+ assertThat (response .getBody ()).isSameAs (resource );
77+ assertThat (response .getStatusCode ().value ()).isEqualTo (400 );
78+ assertThat (response .getHeaders ().getFirst ("ZETA-Cause" )).isEqualTo ("Proxy" );
79+ verify (service ).getHelloZetaResource ();
80+ }
6581}
You can’t perform that action at this time.
0 commit comments