HealthCheck.java

1
package com.github.strengthened.prometheus.healthchecks;
2
3
/**
4
 * A health check for a component of your application.
5
 */
6
public abstract class HealthCheck {
7
8
  /**
9
   * Perform a check of the application component.
10
   *
11
   * @return if the component is healthy, a healthy {@link HealthStatus}; otherwise, an unhealthy
12
   *         {@link HealthStatus} with a descriptive error message or exception
13
   * @throws Exception if there is an unhandled error during the health check; this will result in a
14
   *         failed health check
15
   */
16
  protected abstract HealthStatus check() throws Exception;
17
18
  /**
19
   * Executes the health check, catching and handling any exceptions raised by {@link #check()}.
20
   *
21
   * @return if the component is healthy, a healthy {@link HealthStatus}; otherwise, an unhealthy
22
   *         {@link HealthStatus} with a descriptive error message or exception
23
   */
24
  public HealthStatus execute() {
25
    try {
26 1 1. execute : mutated return of Object value for com/github/strengthened/prometheus/healthchecks/HealthCheck::execute to ( if (x != null) null else throw new RuntimeException ) → KILLED
      return check();
27
    } catch (Exception ignored) {
28 1 1. execute : mutated return of Object value for com/github/strengthened/prometheus/healthchecks/HealthCheck::execute to ( if (x != null) null else throw new RuntimeException ) → KILLED
      return HealthStatus.UNHEALTHY;
29
    }
30
  }
31
32
}

Mutations

26

1.1
Location : execute
Killed by : com.github.strengthened.prometheus.healthchecks.HealthChecksCollectorTest.shouldRegisterAndCollect(com.github.strengthened.prometheus.healthchecks.HealthChecksCollectorTest)
mutated return of Object value for com/github/strengthened/prometheus/healthchecks/HealthCheck::execute to ( if (x != null) null else throw new RuntimeException ) → KILLED

28

1.1
Location : execute
Killed by : com.github.strengthened.prometheus.healthchecks.HealthChecksCollectorTest.shouldExceptionBeUnhealthy(com.github.strengthened.prometheus.healthchecks.HealthChecksCollectorTest)
mutated return of Object value for com/github/strengthened/prometheus/healthchecks/HealthCheck::execute to ( if (x != null) null else throw new RuntimeException ) → KILLED

Active mutators

Tests examined


Report generated by PIT 1.4.3