use of org.springframework.boot.actuate.health.Status in project spring-boot by spring-projects.
the class HealthMvcEndpointTests method customMapping.
@Test
@SuppressWarnings("unchecked")
public void customMapping() {
given(this.endpoint.invoke()).willReturn(new Health.Builder().status("OK").build());
this.mvc.setStatusMapping(Collections.singletonMap("OK", HttpStatus.INTERNAL_SERVER_ERROR));
Object result = this.mvc.invoke(this.request, null);
assertThat(result instanceof ResponseEntity).isTrue();
ResponseEntity<Health> response = (ResponseEntity<Health>) result;
assertThat(response.getBody().getStatus().equals(new Status("OK"))).isTrue();
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
}
Aggregations