mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 18:58:44 +00:00
refactor: health check
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Health Check Pattern
|
||||
title: Health Check
|
||||
category: Behavioral
|
||||
language: en
|
||||
tag:
|
||||
|
||||
@@ -82,7 +82,7 @@ class DatabaseTransactionHealthIndicatorTest {
|
||||
* returns a Health object with Status.UP.
|
||||
*/
|
||||
@Test
|
||||
void whenDatabaseTransactionSucceeds_thenHealthIsUp() {
|
||||
void whenDatabaseTransactionSucceeds_thenHealthIsUp() throws Exception {
|
||||
CompletableFuture<Health> future = CompletableFuture.completedFuture(Health.up().build());
|
||||
when(asynchronousHealthChecker.performCheck(any(Supplier.class), eq(timeoutInSeconds)))
|
||||
.thenReturn(future);
|
||||
@@ -104,7 +104,7 @@ class DatabaseTransactionHealthIndicatorTest {
|
||||
* returns a Health object with Status.DOWN.
|
||||
*/
|
||||
@Test
|
||||
void whenDatabaseTransactionFails_thenHealthIsDown() {
|
||||
void whenDatabaseTransactionFails_thenHealthIsDown() throws Exception {
|
||||
CompletableFuture<Health> future = new CompletableFuture<>();
|
||||
when(asynchronousHealthChecker.performCheck(any(Supplier.class), eq(timeoutInSeconds)))
|
||||
.thenReturn(future);
|
||||
|
||||
Reference in New Issue
Block a user