File tree 2 files changed +20
-1
lines changed
main/java/org/springframework/http
test/java/org/springframework/http
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -317,6 +317,16 @@ public static BodyBuilder unprocessableEntity() {
317
317
return status (HttpStatus .UNPROCESSABLE_ENTITY );
318
318
}
319
319
320
+ /**
321
+ * Create a builder with an
322
+ * {@linkplain HttpStatus#INTERNAL_SERVER_ERROR INTERNAL_SERVER_ERROR} status.
323
+ * @return the created builder
324
+ * @since 5.3.8
325
+ */
326
+ public static BodyBuilder internalServerError () {
327
+ return status (HttpStatus .INTERNAL_SERVER_ERROR );
328
+ }
329
+
320
330
321
331
/**
322
332
* Defines a builder that adds headers to the response entity.
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -159,6 +159,15 @@ public void unprocessableEntity() throws URISyntaxException {
159
159
assertThat (responseEntity .getBody ()).isEqualTo ("error" );
160
160
}
161
161
162
+ @ Test
163
+ public void internalServerError () throws URISyntaxException {
164
+ ResponseEntity <String > responseEntity = ResponseEntity .internalServerError ().body ("error" );
165
+
166
+ assertThat (responseEntity ).isNotNull ();
167
+ assertThat (responseEntity .getStatusCode ()).isEqualTo (HttpStatus .INTERNAL_SERVER_ERROR );
168
+ assertThat (responseEntity .getBody ()).isEqualTo ("error" );
169
+ }
170
+
162
171
@ Test
163
172
public void headers () throws URISyntaxException {
164
173
URI location = new URI ("location" );
You can’t perform that action at this time.
0 commit comments