Skip to content

Commit

Permalink
Increase test coverage for HealthCheckManager (#4666)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhowe authored Jan 30, 2022
1 parent 4c2560b commit afa7ecd
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ void shouldIgnoreUnconfiguredAddedHealthChecks() {

// then
verifyNoInteractions(scheduler);
assertThat(manager.healthStateView(NAME))
.isEmpty();
assertThat(manager.healthStateViews())
.isEmpty();
}

@Test
Expand All @@ -71,6 +75,10 @@ void shouldScheduleHealthCheckWhenConfiguredHealthCheckAdded() {

// then
verifyCheckWasScheduled(scheduler, true);
assertThat(manager.healthStateViews())
.singleElement()
.isEqualTo(manager.healthStateView(NAME).orElseThrow(IllegalStateException::new))
.satisfies(view -> assertThat(view.getName()).isEqualTo(NAME));
}

@Test
Expand All @@ -86,6 +94,11 @@ void shouldUnscheduleTaskWhenHealthCheckRemoved() {

// then
verify(scheduler).unschedule(NAME);
assertThat(manager.healthStateView(NAME))
.isEmpty();
assertThat(manager.healthStateViews())
.singleElement()
.isNull();
}

@Test
Expand Down

0 comments on commit afa7ecd

Please sign in to comment.