1313import org .mockito .InjectMocks ;
1414import org .mockito .Mock ;
1515import org .mockito .junit .jupiter .MockitoExtension ;
16+ import org .springframework .http .HttpMethod ;
1617import org .springframework .http .MediaType ;
1718import org .springframework .mock .http .client .MockClientHttpResponse ;
1819import org .springframework .web .client .HttpClientErrorException ;
@@ -42,7 +43,7 @@ void problemMediaType() throws Exception {
4243 Problem problem = new BadRequestProblem ();
4344 when (objectMapper .readValue (entityStream , Problem .class )).thenReturn (problem );
4445 assertThatExceptionOfType (BadRequestProblem .class )
45- .isThrownBy (() -> handler .handleError (response ))
46+ .isThrownBy (() -> handler .handleError (URI . create ( "test" ), HttpMethod . GET , response ))
4647 .isEqualTo (problem );
4748 }
4849
@@ -55,7 +56,7 @@ void jsonMediaTypeErrorStatus() throws Exception {
5556 Problem problem = new BadRequestProblem ();
5657 when (objectMapper .readValue (entityStream , Problem .class )).thenReturn (problem );
5758 assertThatExceptionOfType (BadRequestProblem .class )
58- .isThrownBy (() -> handler .handleError (response ))
59+ .isThrownBy (() -> handler .handleError (URI . create ( "test" ), HttpMethod . GET , response ))
5960 .isEqualTo (problem );
6061 }
6162
@@ -66,7 +67,7 @@ void jsonMediaTypeNoErrorStatus() {
6667 response .getHeaders ().setContentType (MediaType .APPLICATION_JSON );
6768
6869 assertThatExceptionOfType (UnknownHttpStatusCodeException .class )
69- .isThrownBy (() -> handler .handleError (response ));
70+ .isThrownBy (() -> handler .handleError (URI . create ( "test" ), HttpMethod . GET , response ));
7071 }
7172
7273 @ Test
@@ -78,7 +79,7 @@ void defaultProblem() throws Exception {
7879 Problem problem = new DefaultProblem (URI .create ("type" ), URI .create ("href" ), "Title" , 400 );
7980 when (objectMapper .readValue (entityStream , Problem .class )).thenReturn (problem );
8081 assertThatExceptionOfType (DefaultProblem .class )
81- .isThrownBy (() -> handler .handleError (response ))
82+ .isThrownBy (() -> handler .handleError (URI . create ( "test" ), HttpMethod . GET , response ))
8283 .isEqualTo (problem );
8384 }
8485
@@ -89,7 +90,7 @@ void differentMediaType() {
8990 response .getHeaders ().setContentType (MediaType .APPLICATION_XML );
9091
9192 assertThatExceptionOfType (HttpClientErrorException .BadRequest .class )
92- .isThrownBy (() -> handler .handleError (response ));
93+ .isThrownBy (() -> handler .handleError (URI . create ( "test" ), HttpMethod . GET , response ));
9394 }
9495
9596}
0 commit comments