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
7ff41e7c
Commit
7ff41e7c
authored
Sep 05, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
ca8be3f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
HealthTests.java
.../org/springframework/boot/actuate/health/HealthTests.java
+9
-10
No files found.
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/HealthTests.java
View file @
7ff41e7c
...
@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.entry;
...
@@ -32,6 +32,7 @@ import static org.assertj.core.api.Assertions.entry;
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Michael Pratt
* @author Michael Pratt
* @author Stephane Nicoll
*/
*/
public
class
HealthTests
{
public
class
HealthTests
{
...
@@ -57,7 +58,7 @@ public class HealthTests {
...
@@ -57,7 +58,7 @@ public class HealthTests {
Health
health
=
new
Health
.
Builder
(
Status
.
UP
,
Collections
.
singletonMap
(
"a"
,
"b"
))
Health
health
=
new
Health
.
Builder
(
Status
.
UP
,
Collections
.
singletonMap
(
"a"
,
"b"
))
.
build
();
.
build
();
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UP
);
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UP
);
assertThat
(
health
.
getDetails
()
.
get
(
"a"
)).
isEqualTo
(
"b"
);
assertThat
(
health
.
getDetails
()
).
containsOnly
(
entry
(
"a"
,
"b"
)
);
}
}
@Test
@Test
...
@@ -80,17 +81,15 @@ public class HealthTests {
...
@@ -80,17 +81,15 @@ public class HealthTests {
RuntimeException
ex
=
new
RuntimeException
(
"bang"
);
RuntimeException
ex
=
new
RuntimeException
(
"bang"
);
Health
health
=
new
Health
.
Builder
(
Status
.
UP
,
Collections
.
singletonMap
(
"a"
,
"b"
))
Health
health
=
new
Health
.
Builder
(
Status
.
UP
,
Collections
.
singletonMap
(
"a"
,
"b"
))
.
withException
(
ex
).
build
();
.
withException
(
ex
).
build
();
assertThat
(
health
.
getDetails
().
get
(
"a"
)).
isEqualTo
(
"b"
);
assertThat
(
health
.
getDetails
()).
containsOnly
(
entry
(
"a"
,
"b"
),
assertThat
(
health
.
getDetails
().
get
(
"error"
))
entry
(
"error"
,
"java.lang.RuntimeException: bang"
));
.
isEqualTo
(
"java.lang.RuntimeException: bang"
);
}
}
@Test
@Test
public
void
withDetails
()
{
public
void
withDetails
()
{
Health
health
=
new
Health
.
Builder
(
Status
.
UP
,
Collections
.
singletonMap
(
"a"
,
"b"
))
Health
health
=
new
Health
.
Builder
(
Status
.
UP
,
Collections
.
singletonMap
(
"a"
,
"b"
))
.
withDetail
(
"c"
,
"d"
).
build
();
.
withDetail
(
"c"
,
"d"
).
build
();
assertThat
(
health
.
getDetails
().
get
(
"a"
)).
isEqualTo
(
"b"
);
assertThat
(
health
.
getDetails
()).
containsOnly
(
entry
(
"a"
,
"b"
),
entry
(
"c"
,
"d"
));
assertThat
(
health
.
getDetails
().
get
(
"c"
)).
isEqualTo
(
"d"
);
}
}
@Test
@Test
...
@@ -128,7 +127,7 @@ public class HealthTests {
...
@@ -128,7 +127,7 @@ public class HealthTests {
public
void
unknownWithDetails
()
{
public
void
unknownWithDetails
()
{
Health
health
=
new
Health
.
Builder
().
unknown
().
withDetail
(
"a"
,
"b"
).
build
();
Health
health
=
new
Health
.
Builder
().
unknown
().
withDetail
(
"a"
,
"b"
).
build
();
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UNKNOWN
);
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UNKNOWN
);
assertThat
(
health
.
getDetails
()
.
get
(
"a"
)).
isEqualTo
(
"b"
);
assertThat
(
health
.
getDetails
()
).
containsOnly
(
entry
(
"a"
,
"b"
)
);
}
}
@Test
@Test
...
@@ -142,7 +141,7 @@ public class HealthTests {
...
@@ -142,7 +141,7 @@ public class HealthTests {
public
void
upWithDetails
()
{
public
void
upWithDetails
()
{
Health
health
=
new
Health
.
Builder
().
up
().
withDetail
(
"a"
,
"b"
).
build
();
Health
health
=
new
Health
.
Builder
().
up
().
withDetail
(
"a"
,
"b"
).
build
();
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UP
);
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UP
);
assertThat
(
health
.
getDetails
()
.
get
(
"a"
)).
isEqualTo
(
"b"
);
assertThat
(
health
.
getDetails
()
).
containsOnly
(
entry
(
"a"
,
"b"
)
);
}
}
@Test
@Test
...
@@ -157,8 +156,8 @@ public class HealthTests {
...
@@ -157,8 +156,8 @@ public class HealthTests {
RuntimeException
ex
=
new
RuntimeException
(
"bang"
);
RuntimeException
ex
=
new
RuntimeException
(
"bang"
);
Health
health
=
Health
.
down
(
ex
).
build
();
Health
health
=
Health
.
down
(
ex
).
build
();
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
DOWN
);
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
DOWN
);
assertThat
(
health
.
getDetails
()
.
get
(
"error"
)
)
assertThat
(
health
.
getDetails
())
.
isEqualTo
(
"java.lang.RuntimeException: bang"
);
.
containsOnly
(
entry
(
"error"
,
"java.lang.RuntimeException: bang"
)
);
}
}
@Test
@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