JPAHealthCheck implements HealthCheck { @Override public Mono<Result> check() { return Mono.fromCallable(entityManagerFactory::createEntityManager) .map(entityManager -> entityManager.isOpen()) .map(open -> { if (open) { return healthy(componentName()); } @Inject  JPAHealthCheck(EntityManagerFactory entityManagerFactory); @Override ComponentName componentName(); @Override Mono<Result> check();  }
@Test void testWhenActive() { Result result = jpaHealthCheck.check().block(); ResultStatus healthy = ResultStatus.HEALTHY; assertThat(result.getStatus()).as("Result %s status should be %s", result.getStatus(), healthy) .isEqualTo(healthy); }