11package com .sap .cloud .sdk .datamodel .odata .client .request ;
22
3+ import static org .apache .http .HttpVersion .HTTP_1_1 ;
34import static org .assertj .core .api .Assertions .assertThat ;
45import static org .assertj .core .api .Assertions .assertThatExceptionOfType ;
56
@@ -26,31 +27,17 @@ class ODataHealthyResponseValidatorTest
2627 @ Test
2728 void testSuccess ()
2829 {
29- final ODataRequestResult odataResult = new ODataRequestResult ()
30- {
31- @ Getter
32- private final ODataRequestGeneric oDataRequest = REQUEST ;
33-
34- @ Getter
35- private final HttpResponse httpResponse =
36- new BasicHttpResponse (HttpVersion .HTTP_1_1 , HttpStatus .SC_OK , "OK" );
37- };
30+ final HttpResponse httpResponse = new BasicHttpResponse (HTTP_1_1 , HttpStatus .SC_OK , "OK" );
31+ final ODataRequestResult odataResult = new ODataRequestResultGeneric (REQUEST , httpResponse );
3832
3933 ODataHealthyResponseValidator .requireHealthyResponse (odataResult );
4034 }
4135
4236 @ Test
4337 void testNotFound ()
4438 {
45- final ODataRequestResult odataResult = new ODataRequestResult ()
46- {
47- @ Getter
48- private final ODataRequestGeneric oDataRequest = REQUEST ;
49-
50- @ Getter
51- private final HttpResponse httpResponse =
52- new BasicHttpResponse (HttpVersion .HTTP_1_1 , HttpStatus .SC_NOT_FOUND , "Not Found" );
53- };
39+ final HttpResponse httpResponse = new BasicHttpResponse (HTTP_1_1 , HttpStatus .SC_NOT_FOUND , "Not Found" );
40+ final ODataRequestResult odataResult = new ODataRequestResultGeneric (REQUEST , httpResponse );
5441
5542 assertThatExceptionOfType (ODataResponseException .class )
5643 .isThrownBy (() -> ODataHealthyResponseValidator .requireHealthyResponse (odataResult ))
@@ -81,18 +68,9 @@ void testODataError()
8168 }
8269 """ ;
8370
84- final ODataRequestResult odataResult = new ODataRequestResult ()
85- {
86- @ Getter
87- private final ODataRequestGeneric oDataRequest = REQUEST ;
88-
89- @ Getter
90- private final HttpResponse httpResponse =
91- new BasicHttpResponse (HttpVersion .HTTP_1_1 , HttpStatus .SC_INTERNAL_SERVER_ERROR , "Oh!" );
92- {
93- httpResponse .setEntity (new StringEntity (odata_error_json , StandardCharsets .UTF_8 ));
94- }
95- };
71+ final HttpResponse httpResponse = new BasicHttpResponse (HTTP_1_1 , HttpStatus .SC_INTERNAL_SERVER_ERROR , "Oh!" );
72+ httpResponse .setEntity (new StringEntity (odata_error_json , StandardCharsets .UTF_8 ));
73+ final ODataRequestResult odataResult = new ODataRequestResultGeneric (REQUEST , httpResponse );
9674
9775 assertThatExceptionOfType (ODataServiceErrorException .class )
9876 .isThrownBy (() -> ODataHealthyResponseValidator .requireHealthyResponse (odataResult ))
0 commit comments