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
105df823
Commit
105df823
authored
Aug 03, 2019
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
2cdceb92
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
WebMvcMetricsFilterTests.java
...actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java
+2
-1
WebMvcMetricsIntegrationTests.java
...te/metrics/web/servlet/WebMvcMetricsIntegrationTests.java
+4
-1
No files found.
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilterTests.java
View file @
105df823
...
...
@@ -83,6 +83,7 @@ import org.springframework.web.util.NestedServletException;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatCode
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatExceptionOfType
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatIOException
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
fail
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
asyncDispatch
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
...
...
@@ -186,7 +187,7 @@ class WebMvcMetricsFilterTests {
void
streamingError
()
throws
Exception
{
MvcResult
result
=
this
.
mvc
.
perform
(
get
(
"/api/c1/streamingError"
)).
andExpect
(
request
().
asyncStarted
())
.
andReturn
();
this
.
mvc
.
perform
(
asyncDispatch
(
result
)).
andExpect
(
status
().
isOk
());
assertThatIOException
().
isThrownBy
(()
->
this
.
mvc
.
perform
(
asyncDispatch
(
result
)).
andReturn
());
assertThat
(
this
.
registry
.
get
(
"http.server.requests"
).
tags
(
"exception"
,
"IOException"
).
timer
().
count
())
.
isEqualTo
(
1L
);
}
...
...
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsIntegrationTests.java
View file @
105df823
...
...
@@ -44,8 +44,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.context.WebApplicationContext
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.util.NestedServletException
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
assertj
.
core
.
api
.
Assertions
.
assertThatExceptionOfType
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
request
.
MockMvcRequestBuilders
.
get
;
import
static
org
.
springframework
.
test
.
web
.
servlet
.
result
.
MockMvcResultMatchers
.
status
;
...
...
@@ -84,7 +86,8 @@ class WebMvcMetricsIntegrationTests {
@Test
void
rethrownExceptionIsRecordedInMetricTag
()
throws
Exception
{
this
.
mvc
.
perform
(
get
(
"/api/rethrownError"
)).
andExpect
(
status
().
is5xxServerError
());
assertThatExceptionOfType
(
NestedServletException
.
class
)
.
isThrownBy
(()
->
this
.
mvc
.
perform
(
get
(
"/api/rethrownError"
)).
andReturn
());
assertThat
(
this
.
registry
.
get
(
"http.server.requests"
).
tags
(
"exception"
,
"Exception2"
,
"status"
,
"500"
).
timer
()
.
count
()).
isEqualTo
(
1L
);
}
...
...
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