Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
c2ec46c5
Commit
c2ec46c5
authored
Aug 14, 2020
by
Scott Frederick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish "Fix include exception handling in DefaultErrorAttributes"
See gh-22750
parent
c49605cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
DefaultErrorAttributesTests.java
.../boot/web/reactive/error/DefaultErrorAttributesTests.java
+13
-0
DefaultErrorAttributesTests.java
...k/boot/web/servlet/error/DefaultErrorAttributesTests.java
+11
-0
No files found.
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributesTests.java
View file @
c2ec46c5
...
...
@@ -164,6 +164,19 @@ class DefaultErrorAttributesTests {
assertThat
(
attributes
.
get
(
"message"
)).
isEqualTo
(
"Test"
);
}
@Test
@SuppressWarnings
(
"deprecation"
)
void
excludeExceptionWithDeprecatedConstructor
()
{
RuntimeException
error
=
new
RuntimeException
(
"Test"
);
this
.
errorAttributes
=
new
DefaultErrorAttributes
(
false
);
MockServerHttpRequest
request
=
MockServerHttpRequest
.
get
(
"/test"
).
build
();
ServerRequest
serverRequest
=
buildServerRequest
(
request
,
error
);
Map
<
String
,
Object
>
attributes
=
this
.
errorAttributes
.
getErrorAttributes
(
serverRequest
,
ErrorAttributeOptions
.
of
());
assertThat
(
this
.
errorAttributes
.
getError
(
serverRequest
)).
isSameAs
(
error
);
assertThat
(
attributes
.
get
(
"exception"
)).
isNull
();
}
@Test
void
processResponseStatusException
()
{
RuntimeException
nested
=
new
RuntimeException
(
"Test"
);
...
...
spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/error/DefaultErrorAttributesTests.java
View file @
c2ec46c5
...
...
@@ -231,6 +231,17 @@ class DefaultErrorAttributesTests {
assertThat
(
attributes
.
get
(
"message"
)).
isEqualTo
(
"Test"
);
}
@Test
@SuppressWarnings
(
"deprecation"
)
void
excludeExceptionAttributeWithDeprecatedConstructor
()
{
DefaultErrorAttributes
errorAttributes
=
new
DefaultErrorAttributes
(
false
);
RuntimeException
ex
=
new
RuntimeException
(
"Test"
);
this
.
request
.
setAttribute
(
"javax.servlet.error.exception"
,
ex
);
Map
<
String
,
Object
>
attributes
=
errorAttributes
.
getErrorAttributes
(
this
.
webRequest
,
ErrorAttributeOptions
.
of
());
assertThat
(
attributes
.
get
(
"exception"
)).
isNull
();
}
@Test
void
withStackTraceAttribute
()
{
RuntimeException
ex
=
new
RuntimeException
(
"Test"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment